is_user_option_local

Check whether a usermeta key has to do with the current blog.

Description

is_user_option_local( (string) $key, (int) $user_id = 0, (int) $blog_id = 0 ); 

Parameters (3)

0. $key (string)
The key.
1. $user_id — Optional. (int)
Defaults to current user.
2. $blog_id — Optional. (int)
Defaults to current blog.

Usage

  1. if ( !function_exists( 'is_user_option_local' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4. // The key. 
  5. $key = ''; 
  6.  
  7. // Optional. Defaults to current user. 
  8. $user_id = -1; 
  9.  
  10. // Optional. Defaults to current blog. 
  11. $blog_id = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = is_user_option_local($key, $user_id, $blog_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-functions.php  
  1. function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) { 
  2. global $wpdb; 
  3.  
  4. $current_user = wp_get_current_user(); 
  5. if ( $blog_id == 0 ) { 
  6. $blog_id = $wpdb->blogid; 
  7. $local_key = $wpdb->get_blog_prefix( $blog_id ) . $key; 
  8.  
  9. return isset( $current_user->$local_key );