mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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: https://develop.svn.wordpress.org/trunk@14193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user