is_user_spammy

Check to see whether a user is marked as a spammer, based on user login.

Description

is_user_spammy( (null) $user = null ); 

Parameters (1)

0. $user — Optional. (null) => null
Defaults to current user. WP_User object, or user login name as a string.

Usage

  1. if ( !function_exists( 'is_user_spammy' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4. // Optional. Defaults to current user. WP_User object, 
  5. // or user login name as a string. 
  6. $user = null; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = is_user_spammy($user); 
  10.  

Defined (1)

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

/wp-includes/ms-functions.php  
  1. function is_user_spammy( $user = null ) { 
  2. if ( ! ( $user instanceof WP_User ) ) { 
  3. if ( $user ) { 
  4. $user = get_user_by( 'login', $user ); 
  5. } else { 
  6. $user = wp_get_current_user(); 
  7.  
  8. return $user && isset( $user->spam ) && 1 == $user->spam;