bp_core_check_for_flood( int $user_id )

Check for flooding.


Description Description

Check to make sure that a user is not making too many posts in a short amount of time.


Top ↑

Parameters Parameters

$user_id

(int) (Required) User id to check for flood.


Top ↑

Return Return

(bool) True if there is no flooding, false if there is.


Source Source

File: bp-core/bp-core-moderation.php

function bp_core_check_for_flood( $user_id = 0 ) {

	// Option disabled. No flood checks.
	if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) ) {
		return true;
	}

	// Bail if no user ID passed.
	if ( empty( $user_id ) ) {
		return false;
	}

	$last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
	if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) ) {
		return false;
	}

	return true;
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.