Changeset 3298

Show
Ignore:
Timestamp:
12/13/05 03:46:08 (3 years ago)
Author:
ryan
Message:

Add optional user_id arg.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/functions.php

    r3289 r3298  
    301301} 
    302302 
    303 function get_user_option( $option ) { 
     303function get_user_option( $option, $user = 0 ) { 
    304304    global $wpdb, $current_user; 
    305     if ( isset( $current_user->{$wpdb->prefix . $option} ) ) // Blog specific 
    306         return $current_user->{$wpdb->prefix . $option}; 
    307     elseif ( isset( $current_user->{$option} ) ) // User specific and cross-blog 
    308         return $current_user->{$option}; 
     305     
     306    if ( empty($user) ) 
     307        $user = $current_user; 
     308    else 
     309        $user = get_userdata($user); 
     310 
     311    if ( isset( $user->{$wpdb->prefix . $option} ) ) // Blog specific 
     312        return $user->{$wpdb->prefix . $option}; 
     313    elseif ( isset( $user->{$option} ) ) // User specific and cross-blog 
     314        return $user->{$option}; 
    309315    else // Blog global 
    310316        return get_option( $option );