Sometimes customers hunt me up here. That’s okay. I’d rather you opened a ticket since I like to eat, sleep, and hang out with my wife, but in this case they also had an interesting problem.
When I log in, I get “You do not have sufficient permissions to access this page.”
I found the support ticket and solved it, and then I mailed the DreamPress Ninja’s with this methodology. It relies on wp-cli, so bear with me.
The first thing to do is check the user list:
user@server:~/example.com$ wp user list +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+ | ID | user_login | display_name | user_email | user_registered | roles | +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+ | 2 | bobby | Bobby Done Nightly | bobby@example.com | 2014-02-12 17:44:28 | administrator | | 3 | darren | Darren Done Rightly | darren@example.com | 2014-09-29 17:49:11 | contributor | | 4 | ethan | Ethan Done Wrongly | ethan@example.com | 2014-10-27 21:01:07 | subscriber | | 5 | jimmybear | Jimmy Eaten By A Bear | jimmy@example.com | 2013-12-16 14:45:18 | author | | 1 | iamempty | Admin Account | admin@example.com | 2015-03-05 01:30:09 | | | 6 | sonnyboy | Sonny Boyd | sonny@example.com | 2014-10-27 22:13:08 | contributor | +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+
Notice how imaginet has NO role? That’s the problem. So let’s give it a role!
user@server:~/example.com$ wp user add-role 1 administrator Success: Added 'administrator' role for imaginet (1).
Check again and all is happy!
user@server:~/example.com$ wp user list +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+ | ID | user_login | display_name | user_email | user_registered | roles | +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+ | 2 | bobby | Bobby Done Nightly | bobby@example.com | 2014-02-12 17:44:28 | administrator | | 3 | darren | Darren Done Rightly | darren@example.com | 2014-09-29 17:49:11 | contributor | | 4 | ethan | Ethan Done Wrongly | ethan@example.com | 2014-10-27 21:01:07 | subscriber | | 5 | jimmybear | Jimmy Eaten By A Bear | jimmy@example.com | 2013-12-16 14:45:18 | author | | 1 | iamempty | Admin Account | admin@example.com | 2015-03-05 01:30:09 | administrator | | 6 | sonnyboy | Sonny Boyd | sonny@example.com | 2014-10-27 22:13:08 | contributor | +----+-----------------+--------------------------------+-----------------------------+---------------------+---------------+
If the roles had be totally empty, it’s a case where the database is looking for the ‘wrong’ table prefix and that’s a little messier. There, you’ll want to grab the table prefix from the wp-config.php
file:
$table_prefix = 'wp_hsy671e_';
Then go into the database and look at wp_hsy671e_options
for a field called wp_hsy671e_user_roles
– if you don’t see one, that’s the problem. Check for one named wp_user_roles
and rename it.
If you DO see the right user_roles, then the problem is all the users are pointing to the wrong table. You can just run wp search-replace wp_user_roles wp_hsy671e_user_roles
to force it back.
Comments
One response to “Mailbag: Debugging the Dread “No Permissions””
It’s up to 90% that I have to deal with missing user permissions in the database or the wrong table prefix. It seems, that the plugins (used by my clients) are responsible for most of the hassle by search/replace table prefixes or change/move the entire site.