The Pain of WordPress: "You do not have sufficient permissions to access this page" when trying to upgrade

I searched far and wide for a working solution for this, and in the end had to cook one up myself. For a short description of the issue, every time I tried to use the new (and otherwise higly cool) one-click upgrade feature in one of my blogs, I was greeted with the blunt response of “You do not have sufficient permissions to access this page.” This was made all the more curious by the fact that simultaneously upgrades of plugins did work in very the same blog.

Now, I know how to google and this issue seems alarmingly widespread. Luckily there are also quite a few solutions, but unfortunately, as I said, none of them worked for me. Anyway, here’s a list of the solutions othes have found useful, just in case:

In addition, I tried changing the permissions of wp-content and subfolders, clearing my cookies and cache, logging in and out, reloading and so on — all to no avail. When all of these failed, I began to compare the database tables between my other blogs, in which the upgrade worked smoothly, and the one in which it didn’t.

I first discovered that prefix_options had two options called fileupload_realpath and fileupload_url. In my other, working blog they referred to the correct upload path on my webserver. In the broken one they were at default, example values which of course were flawed. So I fixed the paths thinking I’d found the culprit, but not so: the issue remained. However, this fix probably didn’t hurt either, as the upgrades probably use the ‘upgrade’ subdirectory inside the upload path.

The solution

Then I found that the values of prefix_user_roles in prefix_options differed between the working blogs and the one that didn’t, but didn’t differ among the working ones. So, without any idea of the values’ syntax I simply copied the value from one of the working blogs’ tables and pasted it onto the broken one’s. And that did it: the upgrade now works as intended. Yay!

Just in case someone with only a single blog has this issue, I’ll paste the actual contents of my working prefix_user_roles below. It shouldn’t have anything too unportable, as the value is probably a default set by the installation of one of my more recent blogs.

Note that the newlines in weird-looking places are apparently either part of the syntax, or ignored completely, so copying and pasting the value below should work. Unless WordPress — the installation I’m publishing this post in — somehow screws it up. The browser will break the lines when viewed on this page, but it shouldn’t affect selecting and copying, as it’s only part of the visible rendering.

a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:53:{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: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;}}}

Comments

14 responses to “The Pain of WordPress: "You do not have sufficient permissions to access this page" when trying to upgrade”

  1. Romain Avatar

    Hi ! Thanks a lor for this answer. I do spent some time on the internet for this problem and this is the first tweak that works.
    For information, I was on a 2.7 (fresh install) and needed to upgrade on the 2.7.1, my db prefix was wp_.
    Replacing the wp_user_roles value was enough for me to access the upgrade page, there was no need to modify the upload path and/or url even when my blog is located under a /blog/ subfolder.
    Hope that can help other people ! Thanks again :)

  2. […] tous les droits ! Bref, après des solutions pourries trouvées sur google, je suis tombé sur cette page qui donne la solution via une toute petite retouche de la base de données. Si ce message peut […]

  3. Jani Avatar

    Romain: No problem, glad I could help!

  4. Michelle Avatar
    Michelle

    Simply copying the text to the wp_user_roles did it for me. But, for clarification for those who need a bit more explanation, I had to go to phpadmin, select the wp_options table, and then execute the SQL command:
    SELECT *
    FROM `wp_options`
    WHERE `option_name` = “wp_user_roles”

    and then edit the record returned w/ your text. I was just a bit slow in being able to find that particular record within the table.

    Thanks for the help – hope this bubbles up the google search.

  5. Jani Avatar

    Np Michelle, and thanks for the comment. Depending on your preference, the SQL query you mentioned might be a shortcut — I prefer the mouse: I chose ‘Browse’ from the wp_options view, and then picked wp_user_roles for editing using the pencil icon. (Because I’ve only used phpMyAdmin in Finnish, I’m not sure of the translation of ‘Browse’, but it’s the leftmost of the ‘tabs’ on top of the wp_options listing page.)

  6. Graham Avatar
    Graham

    Many thanks for this, i have been looking for a fix for this problem for the last 3 hours.

    all the best
    Marcus

  7. Shirley Avatar

    I can’t thank you enough for posting about this problem and the wonderful commenter’s suggestions too. I have been trying for months to figure out what was the problem with accessing permission to update my WordPress versions.

    Again THANK YOU!!!!!!
    God Bless, Shirley

  8. Jani Avatar

    Marcus & Shirley: No problem, glad you found this useful!

  9. jcisio Avatar

    Thank you. I have the same problem, and this helps. It seems that Role Manager (http://www.im-web-gefunden.de/wordpress-plugins/role-manager/) causes this problem.

  10. Jani Avatar

    I don’t believe I’ve ever used Role Manager, so at least in my case it wasn’t the culprit. But thanks for the hint anyway, maybe others using Role Manager find it useful when looking for the root cause.

  11. […] de un mes en dique seco, y con energías renovadas, me volví a sumerger en Google y encontré este post que me puso de nuevo sobre mi última […]

  12. Matt Avatar

    Thank you so much for this. By doing this, I was able to do the auto upload after entering my ftp info. However, now when I want to install a plugin, it asks me for the ftp info again. Any idea why that would be the case?

  13. Jani Avatar

    I’m not sure what you mean by ftp, as I’ve never used it in WordPress and to my knowledge ftp isn’t a WordPress feature. If you’re using an ftp plugin, it may be an issue with that.

  14. Matt Avatar

    By ftp, I mean my hosting information that gets me into where the files are stored on the host.