bp_registration_handle_general_settings

Handle processing of new values for general options page.

Description

bp_registration_handle_general_settings( (array) $args = array() ); 

Parameters (1)

0. $args — Optional. (array) => array()
Array of inputs to save.

Usage

  1. if ( !function_exists( 'bp_registration_handle_general_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-registration-options/includes/admin.php'; 
  3.  
  4. // Array of inputs to save. 
  5. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_registration_handle_general_settings($args); 
  9.  

Defined (1)

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

/includes/admin.php  
  1. function bp_registration_handle_general_settings( $args = array() ) { 
  2.  
  3. /** 
  4. * Fires before we've saved our options 
  5. * @since 4.3.0 
  6. * @param array $args Array of inputs to be saved. 
  7. */ 
  8. do_action( 'bpro_hook_before_save_settings', $args ); 
  9.  
  10. // Handle saving our moderate setting. 
  11. if ( ! empty( $args['set_moderate'] ) ) { 
  12. $bp_moderate = sanitize_text_field( $args['set_moderate'] ); 
  13. update_option( 'bprwg_moderate', $bp_moderate ); 
  14. } else { 
  15. delete_option( 'bprwg_moderate' ); 
  16.  
  17. // Handle saving our private network setting. 
  18. if ( ! empty( $args['set_private'] ) ) { 
  19. $privacy_network = sanitize_text_field( $args['set_private'] ); 
  20. update_option( 'bprwg_privacy_network', $privacy_network ); 
  21. } else { 
  22. delete_option( 'bprwg_privacy_network' ); 
  23.  
  24. // Handle saving our BuddyPress notifications setting. 
  25. if ( ! empty( $args['enable_notifications'] ) ) { 
  26. $enable_notifications = sanitize_text_field( $args['enable_notifications'] ); 
  27. update_option( 'bprwg_enable_notifications', $enable_notifications ); 
  28. } else { 
  29. delete_option( 'bprwg_enable_notifications' ); 
  30.  
  31. $activate_message = wp_kses( $args['activate_message'], wp_kses_allowed_html( 'post' ) ); 
  32. update_option( 'bprwg_activate_message', $activate_message ); 
  33.  
  34. $approved_message = wp_kses( $args['approved_message'], wp_kses_allowed_html( 'post' ) ); 
  35. update_option( 'bprwg_approved_message', $approved_message ); 
  36.  
  37. $denied_message = wp_kses( $args['denied_message'], wp_kses_allowed_html( 'post' ) ); 
  38. update_option( 'bprwg_denied_message', $denied_message ); 
  39.  
  40. $admin_pending_message = wp_kses( $args['admin_pending_message'], wp_kses_allowed_html( 'post' ) ); 
  41. update_option( 'bprwg_admin_pending_message', $admin_pending_message ); 
  42.  
  43. $user_pending_message = wp_kses( $args['user_pending_message'], wp_kses_allowed_html( 'post' ) ); 
  44. update_option( 'bprwg_user_pending_message', $user_pending_message ); 
  45.  
  46. /** 
  47. * Fires after we've saved our options 
  48. * @since 4.3.0 
  49. * @param array $args Array of inputs that were saved. 
  50. */ 
  51. do_action( 'bpro_hook_after_save_settings', $args );