Properly wipe capabilities from new site-independent multisite users by using the right key.

props wonderboymusic. fixes #15627

git-svn-id: http://core.svn.wordpress.org/trunk@23307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-01-18 15:30:55 +00:00
parent abeac1dfa8
commit 6b6ba31884
1 changed files with 5 additions and 3 deletions

View File

@ -909,15 +909,17 @@ function wpmu_activate_signup($key) {
* @param string $email The new user's email address.
* @return mixed Returns false on failure, or int $user_id on success
*/
function wpmu_create_user( $user_name, $password, $email) {
function wpmu_create_user( $user_name, $password, $email ) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
$user_id = wp_create_user( $user_name, $password, $email );
if ( is_wp_error($user_id) )
if ( is_wp_error( $user_id ) )
return false;
$user = new WP_User( $user_id );
// Newly created users have no roles or caps until they are added to a blog.
delete_user_option( $user_id, 'capabilities' );
delete_user_option( $user_id, $user->cap_key );
delete_user_option( $user_id, 'user_level' );
do_action( 'wpmu_new_user', $user_id );