is_user_spammy() WordPress Function

This function will take a user's ID as input and return TRUE if the user is considered spammy.

is_user_spammy( string|WP_User $user = null ) #

Determines whether a user is marked as a spammer, based on user login.


Parameters

$user

(string|WP_User)(Optional) Defaults to current user. WP_User object, or user login name as a string.

Default value: null


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/ms-functions.php

function is_user_spammy( $user = null ) {
	if ( ! ( $user instanceof WP_User ) ) {
		if ( $user ) {
			$user = get_user_by( 'login', $user );
		} else {
			$user = wp_get_current_user();
		}
	}

	return $user && isset( $user->spam ) && 1 == $user->spam;
}


Top ↑

Changelog

Changelog
VersionDescription
MU (3.0.0)Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More