Deleting Users results in Malformed SQL Syntax
-
I am upgrading an old .83 bbpress installation to Alpha 1.0r6.
I have about 6k posts in the .83 database.
After upgrading the database I’ve noticed the following problems. Several of the posts in the database were made by users no longer in the database. If a topic containing posts by these now ‘anonymous’ users is displayed, I get the following error at the top of the screen.
DB Error in wp_users::append_meta: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '32) /* WP_Users::append_meta */' at line 1
SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1,,32) /* WP_Users::append_meta */If I delete the anonymous posts in the thread, the problem goes away. Using PHPAdmin I checked the user ID’s assigned to the posts and there are no users with those user ID’s in wp_users. (I have an integrated installation).
I thought the problem was a result of an upgrade, so I created a new user, made some posts, and then deleted that user. The problem still exists. I have not tried this on a clean install and it would be useful if someone could try that.
I am running the default Kak. Blue theme.
I believe I tracked the problem request to a backpress file.
bb-includes/backpress/class.wp-users.php:
if ( $metas = $this->db->get_results("SELECT $meta_field, meta_key, meta_value FROM {$this->db->$meta_table} WHERE $meta_field IN ($ids) /* WP_Users::append_meta */") ) {
I am not a SQL sleuth but I believe the $ids field is being populated with nulls associated with deleted users.
- You must be logged in to reply to this topic.