Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_user_option [ WordPress Function ]

get_user_option ( $option, $user = 0, $deprecated = '' )
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.
Uses:
Returns:
  • (mixed)
Defined at:



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.

The option will first check for the per site name and then the per Network name.

Source


<?php
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 ( ! 
$user->exists() )
        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);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics