From f2d7c06c6d97dcc009dfd8514ca8dbb2b1c19b6b Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 13 Dec 2005 03:46:08 +0000 Subject: [PATCH] Add optional user_id arg. git-svn-id: http://svn.automattic.com/wordpress/trunk@3298 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 5e6bd753d..ff7d65900 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -300,12 +300,18 @@ function get_option($option) { return get_settings($option); } -function get_user_option( $option ) { +function get_user_option( $option, $user = 0 ) { global $wpdb, $current_user; - if ( isset( $current_user->{$wpdb->prefix . $option} ) ) // Blog specific - return $current_user->{$wpdb->prefix . $option}; - elseif ( isset( $current_user->{$option} ) ) // User specific and cross-blog - return $current_user->{$option}; + + if ( empty($user) ) + $user = $current_user; + else + $user = get_userdata($user); + + if ( isset( $user->{$wpdb->prefix . $option} ) ) // Blog specific + return $user->{$wpdb->prefix . $option}; + elseif ( isset( $user->{$option} ) ) // User specific and cross-blog + return $user->{$option}; else // Blog global return get_option( $option ); }