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
git-svn-id: http://svn.automattic.com/wordpress/trunk@14193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc5feeeeb6
commit
9f33300139
|
@ -1110,7 +1110,7 @@ function upgrade_300() {
|
|||
|
||||
if ( $wp_current_db_version < 14139 ) {
|
||||
populate_roles_300();
|
||||
if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
|
||||
if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get1_site_option( 'siteurl' ) === false )
|
||||
add_site_option( 'siteurl', '' );
|
||||
}
|
||||
|
||||
|
|
|
@ -786,8 +786,8 @@ function wpmu_create_user( $user_name, $password, $email) {
|
|||
return false;
|
||||
|
||||
// Newly created users have no roles or caps until they are added to a blog.
|
||||
update_user_option($user_id, 'capabilities', '');
|
||||
update_user_option($user_id, 'user_level', '');
|
||||
delete_user_option( $user_id, 'capabilities' );
|
||||
delete_user_option( $user_id, 'user_level' );
|
||||
|
||||
do_action( 'wpmu_new_user', $user_id );
|
||||
|
||||
|
|
|
@ -258,6 +258,8 @@ function get_user_option( $option, $user = 0, $deprecated = '' ) {
|
|||
* global blog options. If the 'global' parameter is false, which it is by default
|
||||
* it will prepend the WordPress table prefix to the option name.
|
||||
*
|
||||
* Deletes the user option if $newvalue is empty.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @uses $wpdb WordPress database object for queries
|
||||
*
|
||||
|
@ -272,6 +274,12 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
|
|||
|
||||
if ( !$global )
|
||||
$option_name = $wpdb->prefix . $option_name;
|
||||
|
||||
// For backward compatibility. See differences between update_user_meta() and deprecated update_user_meta().
|
||||
// http://core.trac.wordpress.org/ticket/13088
|
||||
if ( is_null( $newvalue ) || is_scalar( $newvalue ) && empty( $newvalue ) )
|
||||
return delete_user_meta( $user_id, $option_name );
|
||||
|
||||
return update_user_meta( $user_id, $option_name, $newvalue );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue