From 54bc1d84c2ed433959ef7bba856bb12eb0cae86a Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 11 Mar 2010 18:28:31 +0000 Subject: [PATCH] Add delete_user_option(). fixes #12573, props TobiasBg. git-svn-id: http://svn.automattic.com/wordpress/trunk@13667 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index 253419fee..7c5ab5c02 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -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. *