Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12776 closed defect (bug) (worksforme)

new ms site sometimes gets no roles

Reported by: rogertheriault's profile RogerTheriault Owned by:
Milestone: Priority: normal
Severity: major Version: 2.9.2
Component: Multisite Keywords:
Focuses: Cc:

Description

After upgrading to WPMU 2.9.2 from 2.8.6, we experienced a strange issue with NEW blogs - the blog's wp_xx_user_roles option was not adequately populated. There were no warnings, complaints, or errors at blog creation time.

Symptoms:

  • the admin could not access the new blog's admin side (the exact message is "You don't have permission to view this blog. Please contact the system administrator.")
  • the Add New User admin panel (for a site admin) only displays the role "Administrator" in the drop-down
  • the wp_xxx_user_roles blog option contains only one "administrator" role with no capabilities (except those added by active plugins)

Looking at the install_blog function in wp-includes/wpmu-functions.php, it seems the order of function calls suddenly matters, once we changed it to the below, we were able to create new blogs with correct user roles:

        $wp_roles->_init();
        populate_roles();

The init function sets the option key for the roles but will not save anything to the db if the global $wp_user_roles already exists.

Environment:

  • Have not tested against trunk
  • we suspect it may not manifest itself in every installation.
  • We do have plugins installed that add capabilities (eg: wp-polls) but those did not cause any issues in 2.8.6.
  • we are using memcached

Steps to reproduce:

  • create a new blog and administrator using the form at the bottom of the Blogs list (as a site admin)
  • using the new admin's credentials, attempt to access the new blog's admin page, eg: http://somesite.com/newblogname/wp-admin/
  • the admin is denied access and debugging indicates the user has no "read" or "edit_user" capabilities
  • Note: site uber-admins can still access the new blog's admin pages

Workaround:

  • copy the serialized array from the wp_xxx_user_roles option of another blog to the new blog.

Change History (1)

#1 @nacin
15 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed

$wp_user_roles is for static definitions of roles/capabilities. It never becomes set when the DB is used.

Possibly a plugin? Please test again on trunk and re-open if you can reproduce on occasion.

Note: See TracTickets for help on using tickets.