WordPress.org

Make WordPress Core

Changeset 13667


Ignore:
Timestamp:
03/11/10 18:28:31 (4 years ago)
Author:
nacin
Message:

Add delete_user_option(). fixes #12573, props TobiasBg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r13617 r13667  
    269269 * @param string $option_name User option name. 
    270270 * @param mixed $newvalue User option value. 
    271  * @param bool $global Optional. Whether option name is blog specific. 
     271 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 
    272272 * @return unknown 
    273273 */ 
     
    278278        $option_name = $wpdb->prefix . $option_name; 
    279279    return update_user_meta( $user_id, $option_name, $newvalue ); 
     280} 
     281 
     282/** 
     283 * Delete user option with global blog capability. 
     284 * 
     285 * User options are just like user metadata except that they have support for 
     286 * global blog options. If the 'global' parameter is false, which it is by default 
     287 * it will prepend the WordPress table prefix to the option name. 
     288 * 
     289 * @since 3.0.0 
     290 * @uses $wpdb WordPress database object for queries 
     291 * 
     292 * @param int $user_id User ID 
     293 * @param string $option_name User option name. 
     294 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 
     295 * @return unknown 
     296 */ 
     297function delete_user_option( $user_id, $option_name, $global = false ) { 
     298    global $wpdb; 
     299 
     300    if ( !$global ) 
     301        $option_name = $wpdb->prefix . $option_name; 
     302    return delete_user_meta( $user_id, $option_name ); 
    280303} 
    281304 
Note: See TracChangeset for help on using the changeset viewer.