WordPress.org

Make WordPress Core

Changeset 14193


Ignore:
Timestamp:
04/23/2010 02:25:05 PM (8 years ago)
Author:
ryan
Message:

Bring back delete on empty value for update_user_option() to preserve back compat. Switch to delete_user_option() in core. Props mdawaffe. fixes #13088

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/upgrade.php

    r14189 r14193  
    11111111    if ( $wp_current_db_version < 14139 ) {
    11121112        populate_roles_300();
    1113         if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
     1113        if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get1_site_option( 'siteurl' ) === false )
    11141114            add_site_option( 'siteurl', '' );
    11151115    }
  • trunk/wp-includes/ms-functions.php

    r14070 r14193  
    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 );
  • trunk/wp-includes/user.php

    r14094 r14193  
    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
     
    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}
Note: See TracChangeset for help on using the changeset viewer.