May 02
WP "You do not have sufficient permissions to access this page"
Today, after I moved the database around on MySQL for one of my WordPress installs, I was suddenly greeted with this error after logging in: "You do not have sufficient permissions to access this page."
Following some of the guidance on the Codex' Login Trouble page brought no resolution, some even felt simple-minded, like deactivating plugins or chaining file permissions - the latter being stupid as this was clearly an application layer problem and nothing with permission on the fs level...
The solution came via this post:
This post mentioned what I had done: renaming the database tables from the default wp_<whatever> to wp_<some-id>_<whatever>. I did this to accommodate multiple WP installs in one database.
Of course, I had properly changed the prefix in the wp-config.php file, from $table_prefix = 'wp_pf_'; to $table_prefix = 'wp_<some-id>_';
The problem was that WP pulls user permissions from the wp_usermeta and the wp_options tables and uses (why! why! why!?) the prefix supplied in the wp-config.php file to build some essential keys, like <prefix>_capabilities in these dbs!
So I could resolve the insufficient permission error by doing this:
You have to update the key/value pairs in the following database-tables:
In the <prefix>_usermeta table, there are several keys that need to be renamed:
<prefix>_capabilities
<prefix>_dashboard_quick_press_last_post_id
<prefix>_prefix_user-settings
<prefix>_user-settings-time
and in the <prefix>_options table:
<prefix>_user_roles
After that, login worked again.