mycred_force_singular_session

Description

This function is used throughout myCRED to prevent users from attempting to submit AJAX forms multiple times. The minimum time that has to pass between AJAX calls is controlled by the MYCRED_MIN_TIME_LIMIT constant.

Available since version 1.7

Returns

(bool) TRUE if an AJAX call was made within the timelimit else FALSE. A task should be terminated if this function returns TRUE.

Parameters

Param Type Required Description
function mycred_force_singular_session(
$user_id int Yes

The users numeric ID.

$key string Yes

A unique meta key that identifies the current transaction.

$timelimit int No

The number of seconds that has to pass between AJAX calls. Defaults to the value of the MYCRED_MIN_TIME_LIMIT constant.

) { ... }

Examples

No example found.