llms_get_spam_activity( string|null $ip = null )

Get the list of potential spam activity.


Parameters Parameters

$ip

(string|null) (Optional) The IP address to get activity for, or leave as null to attempt to determine current IP address.

Default value: null


Top ↑

Return Return

(array|false) The list of potential spam activity if successful, or false if IP could not be determined.


Top ↑

Source Source

File: includes/llms.spam.functions.php

function llms_get_spam_activity( $ip = null ) {
	if ( empty( $ip ) ) {
		$ip = llms_get_ip_address();
	}

	// If we can't determine the IP, let's bail.
	if ( empty( $ip ) ) {
		return false;
	}

	$ip            = preg_replace( '/[^0-9a-fA-F:., ]/', '', $ip );
	$transient_key = 'llms_spam_activity_' . $ip;
	$activity      = get_transient( $transient_key );
	if ( empty( $activity ) || ! is_array( $activity ) ) {
		$activity = array();
	}

	// Remove old items.
	$new_activity = array();
	$now          = time(); // UTC
	foreach ( $activity as $item ) {
		// Determine whether this item is recent enough to include.
		if ( $item > $now - ( absint( LLMS_SPAM_ACTION_TIME_LIMIT ) ) ) {
			$new_activity[] = $item;
		}
	}

	return $new_activity;
}


Top ↑

Changelog Changelog

Changelog
Version Description
9.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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