Many issues with 4.0.x

3.72K viewsIssues
0

Hello, I am having a huge amount of issues after updating the plugin from 3.x to 4.0.x.

First issue, I have downloaded AnsPress “4.0.6” from GitHub, I put 4.0.6 in quotes because either I’m blind or nobody is reporting this. But GitHub says its release 4.0.6, but the code and WordPress say it’s 4.0.5 but there are differences from the 4.0.5 I originally had, to make things more confusing, the AnsPress home page says to download 4.0.5. Need to get this straightened out.

 

Second the recalculate tools are not working, I have run the WP CLI upgrade command and it was successful, but when I go to recalculate all the things, Votes and Flagged Posts never finish, Answers Subscribers, Views do finish, Reputation says it “finished” but I get a list of SQL errors in the error logs.

From my testing, the votes and Flagged Posts both have 450 posts, the others have 246, Looking at the network votes and flagged are sending 6 ajax calls with increment “current” Parameters from 0 to 5, each group is doing 50 so that’s only 300 “being done”, there is no error logs when running them.

As for the reputation errors/warnings, the first one seems to just be a function deceleration issue

PHP Warning: Missing argument 2 for AnsPress_Admin_Ajax::recount_answer_reputation(), called in /var/www/#########/public_html/articles/wp-content/plugins/anspress-question-answer/admin/ajax.php on line 461 and defined in /var/www/#########/public_html/articles/wp-content/plugins/anspress-question-answer/admin/ajax.php on line 488

The function is “recount_answer_reputation( $user_id, $event )” $event is not passed and not used in the function

the SQL error is

WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘WHERE post_author = 0 AND post_type = ‘answer’ AND post_status IN (‘publish’, ‘p’ at line 1 for query SELECT ID FROM WHERE post_author = 0 AND post_type = ‘answer’ AND post_status IN (‘publish’, ‘private_post’) made by do_action(‘wp_ajax_anspress_recount’), WP_Hook->do_action, WP_Hook->apply_filters, AnsPress_Admin_Ajax::anspress_recount, AnsPress_Admin_Ajax::recount_reputation, AnsPress_Admin_Ajax::recount_answer_reputation

looking at the code seems to be a typo again, {$wpdb->ap_reputation} should be {$wpdb->ap_reputations} Missing s on this line
$wpdb->prepare( “SELECT ID FROM {$wpdb->ap_reputation} WHERE post_author = %d AND post_type = ‘answer’ AND post_status IN (‘publish’, ‘private_post’)”, $user_id )

But after fixing the typo it give the error
WordPress database error Unknown column ‘ID’ in ‘field list’ for query SELECT ID FROM wp_ap_reputations WHERE post_author = 0 AND post_type = ‘answer’ AND post_status IN (‘publish’, ‘private_post’) made by do_action(‘wp_ajax_anspress_recount’), WP_Hook->do_action, WP_Hook->apply_filters, AnsPress_Admin_Ajax::anspress_recount, AnsPress_Admin_Ajax::recount_reputation, AnsPress_Admin_Ajax::recount_answer_reputation

assuming that should be rep_id rather then ID but also the post_author column is not in there so I stopped going any further

 

Thank you for taking a look into these issues.

1

Hello Don,

Thanks for reporting issue in detail. I see the issue with recount. I am fixing it now and push to GitHub tomorrow.

Re-count is not required if you use WP CLI command. Cli command handles all upgrade including recounting and deleted old data. Our site AnsPress.io is migrated using same cli command without any issues. But you had already run cli command, so it will not work again unless you restore old backup and run again.

I will update you after pushing fix for re-count.

Thanks

commented on answer

Thanks for the fast response. Not sure what happened then, because as an example this user only shows having a rep of 2 yet as you can see, he should have a lot more. thankfully I have a screenshot of our site from 2015 as you can see he had a 403 Rep. User log http://www.rippletraining.com/articles/ask-the-experts/user/Steve_Martin/reputations/ Screenshot http://www.rippletraining.com/articles/wp-content/uploads/2015/11/question-page-after-scrolling.jpg

Hello Don, I am pushing a fix to GitHub today. Lemme know after updating.

I see there where 3 commits yesterday, but don’t see any changes that would effect the issue so I haven’t downloaded it yet. I am looking at the repo https://github.com/anspress/anspress is that the correct one?

Yes, the fix was not pushed yesterday. It is taking much more time then I expected. I am working on it and push when its ready. Thanks for your patience.

Hello Don, I have pushed a fix to recount reputation. Extended reputation count will be moved to WP_Cli