Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a multisite installation running WP 3.5. My main site and a few other blogs on the network work fine. However, if I register a new user and site, that user gets the "You do not have sufficient permissions to access this page." error any time they try to visit the admin panel of the site. The front end of the site works properly.

When I look at the user in the Network Admin interface, they are shown to be an admin of that site. If I add the Network Admin to the site, I can view the admin area.

I've tried the usual suggestions of disabling and removing all plugins, activating the Twenty Twelve theme and reinstalling the WP core. None of these work. How can I fix this?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

I spent several hours of my Saturday looking for this error. I could not find a guide anywhere on the 'net that described my eventual solution. Here is my solution.

In the WP core, the "You do not have sufficient permissions to access this page." error is generated at the end of /wp-admin/includes/menu.php. A grep of my plugin directories also showed that several plugins also could generate this error.

Make a backup of menu.php, and replace the code inside the if block on lines 224-227 (as of v3.5) with the following:

if ( !user_can_access_admin_page() ) {
   $a = array(
       'Pages No Access' => $_wp_menu_nopriv,
       'User Info' => $current_user,
       'Roles' => $wp_roles->get_names(),
   );
   $s = sprintf("\n<br /><pre>%s</pre>", print_r($a, true));
   do_action('admin_page_access_denied');
   wp_die( __('You do not have sufficient permissions to access this page.'.$s) );
}

DON'T Leave this code live on your site unless you are actively debugging! Replace this with the backup menu.php if you need to step away for a while.

Try to access the admin side again. This error page will tell you a few things:

  1. If you get additional output on your failure page, this tells you that the failure is being generated by the WP core. In my case it was. If you don't get additional output, you know you need to start looking for the plugin that is causing the error.
  2. Any page in the Pages No Access array set to 1 is not accessible to the user. In my case, all pages were set to 1.
  3. In User Info, check to see if the user has the correct roles and capabilities. In my case, the user had a role of 10 and the capabilities they should have as an admin.
  4. In Roles you will see a list of defined roles for the site. In my case, I had no defined roles. Here was my problem.

In my case, I was able to browse my database in phpMyAdmin, and look for the [WPDB_PREFIX]_[SITENO]_user_roles entry in the [WPDB_PREFIX]_[SITENO]_options table. I had changed my WPDB_PREFIX, but some plugin had created a custom user role and written this with the default wp_ prefix. I was able to copy over the entry from a working site into the non-working site. As soon as I did the admin was immediately able to access the site.

My install was further complicated because I was using the new blog templates plugin, and my template site also had it's database corrupted in the same way.

I hope this helps.

share|improve this answer
    
Great solution! Do you think if you did a search/replace on the faulty prefix that would have solved it? P.S. - you should send heaps of scorn to those developers - or at least a firm rebuke :) –  akTed Jan 21 '13 at 19:33
1  
If I knew what the root cause of the problem was from the start, yes I could have done that. My problem was that after 2 hours of my best Google-FU all I could find was variations on the "deactivate all plugins" advice. I will update this if I can pinpoint the culprit. –  cpilko Jan 21 '13 at 19:41

After going through a few solutions including capabilities -nothing seemed to work. I finally rechecked the size of live wp_usermeta verses localhost wp_usermeta and found that the upload had been chopped and missing some values. I emptied the table and re-uploaded the whole usermeta afresh. Wordpress worked straightaway after the upload. - Hope this saves someone time.

share|improve this answer

I had issues with this as well.

What I wanted was to give one user Admin but remove certain menus from the backend admin side bar.

I removed AAM because it was giving permission problems and used Menu Editor Pro instead. Everything works perfectly.

Of course, this is not the most secure way to go about it, it still allows access to the hidden admin pages my manually typing in the urls, but my client wouldn't know how to get there anyway so this works.

share|improve this answer
    
This doesn't really address the issue, but as you already started sharing knowledge, you might want to try to help someone with a fresher question (as this one is quite old) :) –  kaiser yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.