Add option defaults. Add arg to get_user_option() to avoid querying options table if user option is missing. see #8229
git-svn-id: http://svn.automattic.com/wordpress/trunk@9871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -168,9 +168,10 @@ function user_pass_ok($user_login, $user_pass) {
|
||||
*
|
||||
* @param string $option User option name.
|
||||
* @param int $user Optional. User ID.
|
||||
* @param bool $check_global Whether to check for a global option if a per-user option does not exist. Default is true.
|
||||
* @return mixed
|
||||
*/
|
||||
function get_user_option( $option, $user = 0 ) {
|
||||
function get_user_option( $option, $user = 0, $check_global = true ) {
|
||||
global $wpdb;
|
||||
|
||||
$option = preg_replace('|[^a-z0-9_]|i', '', $option);
|
||||
@@ -183,8 +184,10 @@ function get_user_option( $option, $user = 0 ) {
|
||||
$result = $user->{$wpdb->prefix . $option};
|
||||
elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
|
||||
$result = $user->{$option};
|
||||
else // Blog global
|
||||
elseif ( $check_global ) // Blog global
|
||||
$result = get_option( $option );
|
||||
else
|
||||
$result = false;
|
||||
|
||||
return apply_filters("get_user_option_{$option}", $result, $option, $user);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ $wp_version = '2.7-beta3-9863';
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 9621;
|
||||
$wp_db_version = 9872;
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user