bbp_is_user_spammer

Checks if the user has been marked as a spammer.

Description

bbp_is_user_spammer( (int) $user_id = 0 ); 

Parameters (1)

0. $user_id — Optional. (int)
Int The ID for the user.

Usage

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

Defined (1)

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

/includes/users/capabilities.php  
  1. function bbp_is_user_spammer( $user_id = 0 ) { 
  2.  
  3. // Default to current user 
  4. if ( empty( $user_id ) && is_user_logged_in() ) 
  5. $user_id = bbp_get_current_user_id(); 
  6.  
  7. // No user to check 
  8. if ( empty( $user_id ) ) 
  9. return false; 
  10.  
  11. // Assume user is not spam 
  12. $is_spammer = false; 
  13.  
  14. // Get user data 
  15. $user = get_userdata( $user_id ); 
  16.  
  17. // No user found 
  18. if ( empty( $user ) ) { 
  19. $is_spammer = false; 
  20.  
  21. // Check if spam 
  22. } elseif ( !empty( $user->spam ) ) { 
  23. $is_spammer = true; 
  24.  
  25. return (bool) apply_filters( 'bbp_core_is_user_spammer', $is_spammer );