﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
12776	new ms site sometimes gets no roles	RogerTheriault		"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."	defect (bug)	closed	normal		Multisite	2.9.2	major	worksforme		RogerTheriault
