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

git-svn-id: http://svn.automattic.com/wordpress/trunk@13667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-11 18:28:31 +00:00
parent 52979cc4d5
commit 54bc1d84c2
1 changed files with 24 additions and 1 deletions

View File

@ -268,7 +268,7 @@ function get_user_option( $option, $user = 0, $deprecated = '' ) {
* @param int $user_id User ID
* @param string $option_name User option name.
* @param mixed $newvalue User option value.
* @param bool $global Optional. Whether option name is blog specific.
* @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
* @return unknown
*/
function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
@ -279,6 +279,29 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
return update_user_meta( $user_id, $option_name, $newvalue );
}
/**
* Delete user option with global blog capability.
*
* User options are just like user metadata except that they have support for
* 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.
*
* @since 3.0.0
* @uses $wpdb WordPress database object for queries
*
* @param int $user_id User ID
* @param string $option_name User option name.
* @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
* @return unknown
*/
function delete_user_option( $user_id, $option_name, $global = false ) {
global $wpdb;
if ( !$global )
$option_name = $wpdb->prefix . $option_name;
return delete_user_meta( $user_id, $option_name );
}
/**
* Get users for the blog.
*