Make WordPress Core


Ignore:
Timestamp:
11/25/2008 06:33:04 PM (16 years ago)
Author:
ryan
Message:

Add option defaults. Add arg to get_user_option() to avoid querying options table if user option is missing. see #8229

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r9716 r9871  
    169169 * @param string $option User option name.
    170170 * @param int $user Optional. User ID.
     171 * @param bool $check_global Whether to check for a global option if a per-user option does not exist. Default is true.
    171172 * @return mixed
    172173 */
    173 function get_user_option( $option, $user = 0 ) {
     174function get_user_option( $option, $user = 0, $check_global = true ) {
    174175    global $wpdb;
    175176
     
    184185    elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
    185186        $result = $user->{$option};
    186     else // Blog global
     187    elseif ( $check_global ) // Blog global
    187188        $result = get_option( $option );
     189    else
     190        $result = false;
    188191
    189192    return apply_filters("get_user_option_{$option}", $result, $option, $user);
Note: See TracChangeset for help on using the changeset viewer.