Logged into wordpress and greeted by “You do not have sufficient permissions to access this page”

Apr 11th, 2012 | By | Category: wordpress

In the words of Dom, one of my favorite Bondi Hipsters: “Well this is Awks”.

I was doing some redesigning and upgrading of wordpress for a client of mine and to make the process a lot easier and faster I setup a temp version of the site on my server where I didn’t have to deal with the utter nonsense of cpanel.  So got the site where the client was happy, nay thrilled with the results and moved it back to her server.  Site setup went great, the frontend works flawlessly but after successfully loggin into the admin area I was greeted with the following error message:

You do not have sufficient permissions to access this page.

 

Also known as awesome-sauce to any wordpress admin.  GGGAAAAAHHHHHHHH and now it just won’t fucking go away so I’m going to just blog about everything god damn solution I am trying out here.

First a little trick if you find yourself in this situation and need to log out of the admin area but have no logout button handy.  Go here: https://api.wordpress.org/secret-key/1.1/salt/ and copy the contents of that page and replace the equivalent keys in your wp-config.php file with them.. This will log out all users.

Now as per the solutions I’ve found:

  1. Turn on Debug Mode: Go into your wp-config.php file and search for ‘debug’ , you should find a line that has a variable of false.. Change that to true and see if you get anything more informative in terms of error messages that point you in the right direction to solve your problem
  2. Prefix problems: The most common one by far seems to be changing the table prefix.  I guess sometimes people move the site from one database with the default _wp prefix to somewhere else that doesn’t have this prefix in the table.  this is easy enough, just go into the wp-config.php file and find the prefix setting and change it to whatever prefix you are seeing when looking at the DB in phpmyadmin or whatever. You should note that case matters here so if your config file says Wp_ and your database says wp_ that’s not going to fly, the case of all the letters needs to be identical.   But of course this isn’t my problem so onto the next!
  3. .HTACCESS: The second solution is something to do with the .htaccess file.  Now this got me the most excited as I actually did edit the .htaccess file so it wouldn’t forward everyone back to her old url and I could work on the tmp version on a subdirectory of my hostyourworld.com domain.  Of course after reverted to the original again this didn’t do a god damn thing.
  4. Force a DB upgrade: This is kind of cool to know how to do actually, regardless of if it does fuck all for my problem. Go into your database and into wp_options yuo should find ‘db_version’ .  and it should probably be something like 19470 or something if you aren’t operating a version of WP from the bronze age.  Change it to 8204 or something like that and then reload the wp-admin/ page and you’ll be prompted to do a DB upgrade.. Sometimes this resets problematic settings and fixes everything.  Well it does for normal people, I’m a freak you see, the special kind of freak that needs to try 9432 solutions before stumbling upon the one that actually applies to him
  5. A plugin or theme problem:  Create a new directory in wp-content called bak_plugs and move all the plugins in the plugins/ directory into there and see if you can access your dashboard now.  If you can then move the plugins back one at a time, refreshing the dashboard after each one to narrow down the problem.  If it wasn’t the plugins then try to rename the directory of whatever theme you are using (ie: themes/yourtheme/) to something else, forcing WP to use the default theme.
  6. Yummy Cookies: Delete all of your cookies and/or try to login from another browser.
  7. Edits to wp-config or wp-settings file: Have you made any additions to these files recently?  If so go remove those additions and see if that fixes it.  If it does you’ll have to find another way to accomplish what you were trying to accomplish

 

And the solution to my problem WWWASSSSS:

HUMAN ERROR: So before I moved the site to the clients server I went into and did a global search replace with sed on the the dumped sql file to replace the paths on my server with the new paths on the clients server.. so for example /home/hosting/example/domain/ was supposed to be replaced with /path/to/site/on/clients/server/

HOWEVER

it was missing a bloody trailing slash. GAH!  So go through your dumped .sql file with the fine tooth comb and make extra sure nothing is screwed up there.

 

Tags: , , , , ,

5 Comments to “Logged into wordpress and greeted by “You do not have sufficient permissions to access this page””

  1. Miguel Peixe says:

    Tried everything you said, no luck. In the end, for some weird reason, my wp_user_roles row in the wp_options table was empty, with just my custom role. Not sure if it was because of some WordPress upgrade or because I was using add_role directly on my theme’s function, without hooking it with theme setup.

    Solution was to manually fill wp_user_roles row with the default data and everything went back to normal:

    a:5:{s:13:”administrator”;a:2:{s:4:”name”;s:13:”Administrator”;s:12:”capabilities”;a:62:{s:13:”switch_themes”;b:1;s:11:”edit_themes”;b:1;s:16:”activate_plugins”;b:1;s:12:”edit_plugins”;b:1;s:10:”edit_users”;b:1;s:10:”edit_files”;b:1;s:14:”manage_options”;b:1;s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:6:”import”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:8:”level_10″;b:1;s:7:”level_9″;b:1;s:7:”level_8″;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;s:12:”delete_users”;b:1;s:12:”create_users”;b:1;s:17:”unfiltered_upload”;b:1;s:14:”edit_dashboard”;b:1;s:14:”update_plugins”;b:1;s:14:”delete_plugins”;b:1;s:15:”install_plugins”;b:1;s:13:”update_themes”;b:1;s:14:”install_themes”;b:1;s:11:”update_core”;b:1;s:10:”list_users”;b:1;s:12:”remove_users”;b:1;s:9:”add_users”;b:1;s:13:”promote_users”;b:1;s:18:”edit_theme_options”;b:1;s:13:”delete_themes”;b:1;s:6:”export”;b:1;}}s:6:”editor”;a:2:{s:4:”name”;s:6:”Editor”;s:12:”capabilities”;a:34:{s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;}}s:6:”author”;a:2:{s:4:”name”;s:6:”Author”;s:12:”capabilities”;a:10:{s:12:”upload_files”;b:1;s:10:”edit_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:4:”read”;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;s:22:”delete_published_posts”;b:1;}}s:11:”contributor”;a:2:{s:4:”name”;s:11:”Contributor”;s:12:”capabilities”;a:5:{s:10:”edit_posts”;b:1;s:4:”read”;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;}}s:10:”subscriber”;a:2:{s:4:”name”;s:10:”Subscriber”;s:12:”capabilities”;a:2:{s:4:”read”;b:1;s:7:”level_0″;b:1;}}}

  2. admin says:

    Thanks so much for the tip, hopefully together we can save some folks a lot of grief

  3. Marek says:

    thanks, but it does not solve my problem …

  4. Krzysztof says:

    @miguel – that was my problem too, nice catch 🙂 saved my ass 🙂

  5. Vit says:

    Mine neither. I tried almost everything, also all what you write there, but still the same. I realised error goes away on one page reload when you change wp-config salts and security keys or remove them. Next step in my case will be asking host to check file permissions and trying to move site to another hoster. i think still its something with mysql this error.

Leave a Comment