WordPress.org

Make WordPress Core

Ticket #13088: 13088.b.diff

File 13088.b.diff, 1.5 KB (added by mdawaffe, 4 years ago)
  • wp-includes/user.php

     
    258258 * global blog options. If the 'global' parameter is false, which it is by default 
    259259 * it will prepend the WordPress table prefix to the option name. 
    260260 * 
     261 * Deletes the user option if $newvalue is empty. 
     262 * 
    261263 * @since 2.0.0 
    262264 * @uses $wpdb WordPress database object for queries 
    263265 * 
     
    272274 
    273275        if ( !$global ) 
    274276                $option_name = $wpdb->prefix . $option_name; 
     277 
     278        // For backward compatibility.  See differences between update_user_meta() and deprecated update_user_meta(). 
     279        // http://core.trac.wordpress.org/ticket/13088 
     280        if ( is_null( $newvalue ) || is_scalar( $newvalue ) && empty( $newvalue ) ) 
     281                return delete_user_meta( $user_id, $option_name ); 
     282 
    275283        return update_user_meta( $user_id, $option_name, $newvalue ); 
    276284} 
    277285 
  • wp-includes/ms-functions.php

     
    786786                return false; 
    787787 
    788788        // Newly created users have no roles or caps until they are added to a blog. 
    789         update_user_option($user_id, 'capabilities', ''); 
    790         update_user_option($user_id, 'user_level', ''); 
     789        delete_user_option( $user_id, 'capabilities' ); 
     790        delete_user_option( $user_id, 'user_level' ); 
    791791 
    792792        do_action( 'wpmu_new_user', $user_id ); 
    793793