bbp_add_user_options

Add default user options.

Description

bbp_add_user_options( (int) $user_id = 0 ); 

This is destructive, so existing bbPress user options will be overridden.

Parameters (1)

0. $user_id — Optional. (int)
The user id.

Usage

  1. if ( !function_exists( 'bbp_add_user_options' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/options.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_add_user_options($user_id); 
  9.  

Defined (1)

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

/includes/users/options.php  
  1. function bbp_add_user_options( $user_id = 0 ) { 
  2.  
  3. // Validate user id 
  4. $user_id = bbp_get_user_id( $user_id ); 
  5. if ( empty( $user_id ) ) 
  6. return; 
  7.  
  8. // Add default options 
  9. foreach ( bbp_get_default_user_options() as $key => $value ) 
  10. update_user_option( $user_id, $key, $value ); 
  11.  
  12. // Allow previously activated plugins to append their own user options. 
  13. do_action( 'bbp_add_user_options', $user_id );