Make WordPress Core


Ignore:
Timestamp:
12/13/2005 03:46:08 AM (20 years ago)
Author:
ryan
Message:

Add optional user_id arg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 );
Note: See TracChangeset for help on using the changeset viewer.