Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FloodInterface.php

function FloodInterface::isAllowed

Checks whether a user is allowed to proceed with the specified event.

Events can have thresholds saying that each user can only do that event a certain number of times in a time window. This function verifies that the current user has not exceeded this threshold.

Parameters

string $name: The name of an event.

int $threshold: The maximum number of times each user can do this event per time window.

int $window: (optional) Number of seconds in the time window for this event (default is 3600 seconds, or 1 hour).

string $identifier: (optional) Unique identifier of the current user. Defaults to the current user's IP address).

Return value

bool TRUE if the user is allowed to proceed. FALSE if they have exceeded the threshold and should not be allowed to proceed.

2 methods override FloodInterface::isAllowed()
DatabaseBackend::isAllowed in core/lib/Drupal/Core/Flood/DatabaseBackend.php
Checks whether a user is allowed to proceed with the specified event.
MemoryBackend::isAllowed in core/lib/Drupal/Core/Flood/MemoryBackend.php
Checks whether a user is allowed to proceed with the specified event.

File

core/lib/Drupal/Core/Flood/FloodInterface.php, line 64

Class

FloodInterface
Defines an interface for flood controllers.

Namespace

Drupal\Core\Flood

Code

public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL);

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal