• Resolved trillamar

    (@trillamar)


    Hi WordPress community,

    I had a really hard time troubleshooting the dreaded “you do not have sufficient permissions to access this page.” error. I read tons of posts in the forums and nothing worked.

    The problem happened as I was migrating a site from one host to another and I had to change the table prefix. I didn’t do it right the first time around, hence the error.

    I wrote a blog post that summarizes the solution here.

    Hope it helps some of you. Thanks for all the support over the years of troubleshooting!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator James Huff

    (@macmanx)

    Would you mind posting the fix here, or at least giving a quick summary of it, so that it can be found via the place where most people search for WordPress answers?

    Posts that simply exist to link elsewhere are generally thought of as spam, so it would be greatly appreciated if you would add the answer to this permanent searchable record of answers for WordPress users.

    Thread Starter trillamar

    (@trillamar)

    Hi James,

    Thanks for the suggestion. Here’s the content:

    The error was:
    YOU DO NOT HAVE SUFFICIENT PERMISSIONS TO ACCESS THIS PAGE.

    As we migrate, we usually take the old database and do a few search and replace operations:
    1. check siteurl and replace the old url with the new one.
    2. search for “home” and find out what the absolute path is for the server environment. Replace the old path with the new (e.g., “home/acctname/public_html/” gets changed to “home/acctname/www.yourdomain.com/” in the case of lunarpages to dreampress).
    3. check wp-config in the old environment vs. new one for table prefix. In our case the old environment was “wp_” and the new environment’s table prefix was “wp_acctname_”. I did a search and replace and replaced ‘wp_ with ‘wp_acctname_

    After importing the new database, the web site looked great from the front end, but as soon as we tried to log into WordPress we got that dreaded message.

    After googling it, there were a bunch of suggestions we tried, such as:
    1. check the user’s wp_capabilities and make sure they don’t have the wrong type of quotes
    2. check the user’s wp_user_level
    3. look for corrupt tables in the db

    But none of those worked. In the end, it was an issue related to my step #3 that I didn’t do correctly. My new environment had that special table prefix, and I hadn’t done the search and replace properly.

    We had a look around and found the issue, and it relates to the various places the table prefix shows up in the database.

    THE DATABASE TABLE PREFIX IS NOT JUST USED IN THE DATABASE TABLE NAMES. IT’S ALSO USED IN DATA!

    If that data isn’t also changed, a permission error happens because the returned values will be empty.

    Specifically, these changes fixed the issue:

    In the table: wp_acctname_options
    there was an option named: wp_user_roles
    that had to be renamed to use the prefix: wp_acctname_user_roles

    And in table: wp_acctname_usermeta
    there was a meta_key: wp_capabilities
    that had to be renamed to use the prefix: wp_acctname_capabilities

    And there were some other meta_key names in the user_meta table that started with wp_ and were expecting the same treatment, so I changed those as well. But these 2 were the critical ones preventing logins from happening.

    After making those changes, the login worked again.

    Moderator James Huff

    (@macmanx)

    Excellent, thanks for sharing that here!

    trillamar, Please give me your address – I want to send you some roses!
    Thanks so much!
    You probably know how much time I spent on fixing this, and your answer is just what I needed.

    Tag for SEO: Fix “you do not have sufficient permissions to access this page” after migrate and table prefix change

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘fix for "you do not have sufficient permissions to access this page"’ is closed to new replies.