bbp_is_user_spammer( int $user_id )

Checks if the user has been marked as a spammer.

Description

Parameters

$user_id

(Required) int The ID for the user.

Return

(bool) True if spammer, False if not.

Source

File: bp-forums/users/capabilities.php

function bbp_is_user_spammer( $user_id = 0 ) {

	// Default to current user
	if ( empty( $user_id ) && is_user_logged_in() )
		$user_id = bbp_get_current_user_id();

	// No user to check
	if ( empty( $user_id ) )
		return false;

	// Assume user is not spam
	$is_spammer = false;

	// Get user data
	$user = get_userdata( $user_id );

	// No user found
	if ( empty( $user ) ) {
		$is_spammer = false;

	// Check if spam
	} elseif ( !empty( $user->spam ) ) {
		$is_spammer = true;
	}

	return (bool) apply_filters( 'bbp_core_is_user_spammer', $is_spammer );
}

Changelog

Changelog
Version Description
bbPress (r3355) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.