WordPress.org

Make WordPress Core

Changeset 23307


Ignore:
Timestamp:
01/18/13 15:30:55 (15 months ago)
Author:
markjaquith
Message:

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

props wonderboymusic. fixes #15627

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r23107 r23307  
    910910 * @return mixed Returns false on failure, or int $user_id on success 
    911911 */ 
    912 function wpmu_create_user( $user_name, $password, $email) { 
     912function wpmu_create_user( $user_name, $password, $email ) { 
    913913    $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) ); 
    914914 
    915915    $user_id = wp_create_user( $user_name, $password, $email ); 
    916     if ( is_wp_error($user_id) ) 
     916    if ( is_wp_error( $user_id ) ) 
    917917        return false; 
    918918 
     919    $user = new WP_User( $user_id ); 
     920     
    919921    // Newly created users have no roles or caps until they are added to a blog. 
    920     delete_user_option( $user_id, 'capabilities' ); 
     922    delete_user_option( $user_id, $user->cap_key ); 
    921923    delete_user_option( $user_id, 'user_level' ); 
    922924 
Note: See TracChangeset for help on using the changeset viewer.