bb_delete_user_setting

Delete user interface settings.

Description

bb_delete_user_setting( (string) $names ); 

Deleting settings would reset them to the defaults.

Parameters (1)

0. $names (string)
The name or array of names of the setting to be deleted.

Usage

  1. if ( !function_exists( 'bb_delete_user_setting' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-meta.php'; 
  3.  
  4. // The name or array of names of the setting to be deleted. 
  5. $names = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_delete_user_setting($names); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-meta.php  
  1. function bb_delete_user_setting( $names ) 
  2. $names = (array) $names; 
  3.  
  4. if ( !$user = bb_get_current_user() ) { 
  5. return; 
  6.  
  7. foreach ( $names as $name ) { 
  8. if ( isset( $arr[$name] ) ) { 
  9. unset( $arr[$name] ); 
  10. $settings = ''; 
  11.  
  12. if ( isset( $settings ) ) { 
  13. foreach ( $arr as $k => $v ) { 
  14. $settings .= $k . '=' . $v . '&'; 
  15. $settings = rtrim( $settings, '&' ); 
  16.  
  17. bb_update_usermeta( $user->ID, 'bb_user_settings', $settings ); 
  18. setcookie( 'bb-user-settings-' . $user->ID, $settings, time() + 31536000, $bb->cookiepath );