Make WordPress Core


Ignore:
Timestamp:
04/23/2010 02:25:05 PM (16 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.