You are here

function hook_honeypot_time_limit in Honeypot 2.0.x

Same name and namespace in other branches
  1. 8 honeypot.api.php \hook_honeypot_time_limit()
  2. 6 honeypot.api.php \hook_honeypot_time_limit()
  3. 7 honeypot.api.php \hook_honeypot_time_limit()

Add time to the Honeypot time limit.

In certain circumstances (for example, on forms routinely targeted by spammers), you may want to add an additional time delay. You can use this hook to return additional time (in seconds) to honeypot when it is calculates the time limit for a particular form.

Parameters

int $honeypot_time_limit: The current honeypot time limit (in seconds), to which any additions you return will be added.

array $form_values: Array of form values (may be empty).

int $number: Number of times the current user has already fallen into the honeypot trap.

Return value

int Additional time to add to the honeypot_time_limit, in seconds (integer).

1 invocation of hook_honeypot_time_limit()
honeypot_get_time_limit in ./honeypot.module
Look up the time limit for the current user.

File

./honeypot.api.php, line 89
API Functionality for Honeypot module.

Code

function hook_honeypot_time_limit($honeypot_time_limit, array $form_values, $number) {
  $additions = 0;

  // If 'some_interesting_value' is set in your form, add 10 seconds to limit.
  if (!empty($form_values['some_interesting_value']) && $form_values['some_interesting_value']) {
    $additions = 10;
  }
  return $additions;
}