My error logs are getting filled with this error that is coming from the User Access Manager plugin and I can't figure out what is causing it.
[07-Jul-2011 19:20:38] WordPress database error Table 'dbname.DB_ACCESSGROUP_TO_POST' doesn't exist for query DELETE FROM DB_ACCESSGROUP_TO_POST
WHERE post_id = 1132769 made by wp_delete_attachment, do_action, call_user_func_array, UserAccessManager->removePostData
Looking around the web I see this popping up in error_log's on a lot of sites. Just search google for DB_ACCESSGROUP_TO_POST and you will get servers that have their error_log files indexed by google. So it looks like a bug in the plugin. I looked through the code and can't find a place where the constant DB_ACCESSGROUP_TO_POST is set. That is why DB_ACCESSGROUP_TO_POST is being placed in the query string.
Hello? Anybody supporting this plugin anymore? I've found a few more constants that are used for deleting from the database that are never defined.
-- undefined constants --
DB_ACCESSGROUP_TO_POST
DB_ACCESSGROUP_TO_USER
DB_ACCESSGROUP_TO_CATEGORY
-- defined constants --
DB_ACCESSGROUP_TO_OBJECT
DB_ACCESSGROUP
I could fix the code myself if I knew what the tables looked like but there are no create statements for these tables. Should they just point to the same table as DB_ACCESSGROUP_TO_OBJECT? Anybody have any ideas what is going on here?
I think DB_ACCESSGROUP_TO_POST and the others are old constants that the developer forgot to update with the more generic DB_ACCESSGROUP_TO_OBJECT constant. So I changed them into using DB_ACCESSGROUP_TO_OBJECT instead.
For example:
public function removePostData($postId)
{
global $wpdb;
$wpdb->query(
"DELETE FROM " . DB_ACCESSGROUP_TO_OBJECT . "
WHERE object_id = ".$postId . " AND (object_type='post' OR object_type='page')"
);
}