You are here

function notifications_anonymous_flood_control in Notifications 6.4

Check flood control, optionally printing an error message

1 call to notifications_anonymous_flood_control()
notifications_anonymous_notifications_subscription in notifications_anonymous/notifications_anonymous.module
Implementation of hook_notifications_subscription()

File

notifications_anonymous/notifications_anonymous.module, line 288
Notifications for anonymous users

Code

function notifications_anonymous_flood_control($warning = FALSE) {

  // Check flood control
  $threshold = variable_get('notifications_anonymous_hourly_threshold', 3);
  if (flood_is_allowed('notifications_anonymous', $threshold)) {
    return TRUE;
  }
  elseif ($warning) {
    drupal_set_message(t("You cannot create more than %number subscriptions per hour. Please try again later.", array(
      '%number' => $threshold,
    )), 'warning');
  }
  return FALSE;
}