bp_admin_sanitize_callback_blogforum_comments

Sanitization for bp-disable-blogforum-comments setting.

Description

bp_admin_sanitize_callback_blogforum_comments( (bool) $value = false ); 

In the UI, a checkbox asks whether you'd like to *enable* blog/forum activity comments. For legacy reasons, the option that we store is 1 if these comments are *disabled*. So we use this function to flip the boolean before saving the intval.

Parameters (1)

0. $value — Optional. (bool) => false
Whether or not to sanitize.

Usage

  1. if ( !function_exists( 'bp_admin_sanitize_callback_blogforum_comments' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-settings.php'; 
  3.  
  4. // Whether or not to sanitize. 
  5. $value = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_admin_sanitize_callback_blogforum_comments($value); 
  9.  

Defined (1)

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

/bp-core/admin/bp-core-admin-settings.php  
  1. function bp_admin_sanitize_callback_blogforum_comments( $value = false ) { 
  2. return $value ? 0 : 1;