Definition:
function get_user_option( $option, $user = 0, $deprecated = '' ) {}
Retrieve user option that can be either per Site or per Network.
If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result, will also pass the original option name and finally the user data object as the third parameter.
Parameters
- string $option: User option name.
- int $user: Optional. User ID.
- bool $deprecated: Use get_option() to check for an option in the options table.
Defined filters
- get_user_option_{$option}
apply_filters("get_user_option_{$option}", $result, $option, $user)
Source code
function get_user_option( $option, $user = 0, $deprecated = '' ) { global $wpdb; if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, '3.0' ); if ( empty( $user ) ) $user = wp_get_current_user(); else $user = new WP_User( $user ); if ( ! isset( $user->ID ) ) return false; if ( $user->has_prop( $wpdb->prefix . $option ) ) // Blog specific $result = $user->get( $wpdb->prefix . $option ); elseif ( $user->has_prop( $option ) ) // User specific and cross-blog $result = $user->get( $option ); else $result = false; return apply_filters("get_user_option_{$option}", $result, $option, $user);
1903
No comments yet... Be the first to leave a reply!