Is wp_rmp_analytics table present in your database?
I am unable to replicate the issue.
Hi, apologies for the delay, but it took some time to get back on this.
unfortunately, i dont have direct access to the database, so i had to figure out how to check if the table exists… and -as expected- the table does not exist.
I’ve added this snippet to my theme:
global $wpdb;
$result = $wpdb->get_results ( "SELECT * FROM wp_rmp_analytics");
if($wpdb->last_error){
var_dump($wpdb->last_error);
var_dump($wpdb->last_query);
}
foreach($result as $row){
var_dump($row);
}
which throws
string(58) "Table 'wp_xyz.wp_rmp_analytics' doesn't exist"
string(30) "SELECT * FROM wp_rmp_analytics"
I’ve deleted the plugin again and updated to the latest (4.1.0) version.
Hmm.. running queries manually triggered me to try to simply add the table manually.
(by getting the schema from class-rate-my-post-upgrader.php)
But if i run that, i get this error, which explains why the table doesnt exist
Failed to generate invisible primary key. Auto-increment column already exists.
Apparently this can happen on MySQL on Azure, which is what i’m running
https://learn.microsoft.com/en-us/azure/dms/known-issues-azure-mysql-fs-online
An other plugin seems to have run into a similar problem, with MSSQL 8 on Azure, where sql_generate_invisible_primary_key apparently is turned on by default.
found a solution!
change the last line
UNIQUE KEY id (id)
into
PRIMARY KEY (id)
this way sql_generate_invisible_primary_key isnt triggered, since there is an actual PRIMARY key, instead of a UNIQUE that is used as a primary.
(because if there is no explicit primary, it will generate an invisible primary)
—
I did it by just running this code from my theme functions.php
global $wpdb;
$table_name = $wpdb->prefix . 'rmp_analytics';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
ip tinytext NOT NULL,
country tinytext NOT NULL,
user smallint(5) NOT NULL,
post mediumint(9) NOT NULL,
action smallint(5) NOT NULL,
duration smallint(5) NOT NULL,
average decimal(2, 1) NOT NULL,
votes smallint(5) NOT NULL,
value smallint(5) NOT NULL,
token tinytext NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
$results = $wpdb->get_results($sql);
if ($wpdb->last_error) {
echo "err";
var_dump($wpdb->last_error);
var_dump($wpdb->last_query);
}
foreach($results as $row){
var_dump($row);
}
-
This reply was modified 1 year, 11 months ago by
Koesper. Reason: added sample code
You right. Thanks for your hard work.
This will be fixed in the next update.
Crap, close, but no cigar!
the actual feedback is not saved properly?
I see the data in wp_postmeta, but it doesnt show in the ‘feedback’ display below the post.
That’s weird as the feedbacks are pulled from the post metadata.
Are you sure the feedback you see share same post ID as the post?
Yeah, i see data like this
object(stdClass)#2824 (4) {
["meta_id"]=>
string(4) "5247"
["post_id"]=>
string(3) "246"
["meta_key"]=>
string(20) "rmp_feedback_val_new"
["meta_value"]=>
string(156) "a:1:{i:0;a:5:{s:8:"feedback";s:15:"TEST FEEDBACK 1";s:4:"time";s:19:"18-06-2024 11:07:02";s:2:"id";s:13:"66716a564f841";s:4:"user";i:2;s:8:"ratingID";i:8;}}"
}
if I run this query
$postid = get_the_ID();
$sql = "SELECT * FROM wp_postmeta where post_id = $postid and meta_key like 'rmp_%';";
Not quite sure how to deconstruct that meta_value, but it looks like that ID string (“66716a564f841”) is not correct?
(probably because i hacked the UNIQUE / PRIMARY thing in the table?)
I have been able to reproduce the issue. It was indeed a bug and I will be releasing an update shortly.
Update is now live. That should fix the issue.
Thanks for reporting this bug to us.
Awesome, seems to work!
Thanks for your quick and friendly response.