bp_registration_set_moderation_status

Update our moderation status for a user.

Description

(int) bp_registration_set_moderation_status( (int) $user_id = 0, (string) $status = 'true' ); 

Returns (int)

Meta row ID that got updated.

Parameters (2)

0. $user_id — Optional. (int)
User ID to update.
1. $status — Optional. (string) => 'true'
Value to update the user meta to.

Usage

  1. if ( !function_exists( 'bp_registration_set_moderation_status' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-registration-options/includes/core.php'; 
  3.  
  4. // User ID to update. 
  5. $user_id = -1; 
  6.  
  7. // Value to update the user meta to. 
  8. $status = 'true'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_registration_set_moderation_status($user_id, $status); 
  12.  

Defined (1)

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

/includes/core.php  
  1. function bp_registration_set_moderation_status( $user_id = 0, $status = 'true' ) { 
  2. $user = get_userdata( $user_id ); 
  3.  
  4. if ( ! $user ) { 
  5. return false; 
  6.  
  7. delete_user_meta( $user_id, '_bprwg_is_moderated' ); 
  8. return update_user_meta( absint( $user_id ), '_bprwg_is_moderated', $status );