| 1 user.api.php | hook_user_flood_control($ip, $username = FALSE) | 
Respond to user flood control events.
This hook allows you to act when an unsuccessful user login has triggered flood control. This means that either an IP address or a specific user account has been temporarily blocked from logging in.
@since 1.21.2
Parameters
$ip: The IP address that triggered flood control.
$username: The username that has been temporarily blocked.
See also
Related topics
File
- core/modules/ user/ user.api.php, line 513 
- Hooks provided by the User module.
Code
function hook_user_flood_control($ip, $username = FALSE) {
  if (!empty($username)) {
    // Do something with the blocked $username and $ip. For example, send an
    // e-mail to the user and/or site administrator.
    // Backdrop core uses this hook to log the event:
    watchdog('user', 'Flood control blocked login attempt for %user from %ip.', array('%user' => $username, '%ip' => $ip));
  }
  else {
    // Do something with the blocked $ip. For example, add it to a block-list.
    // Backdrop core uses this hook to log the event:
    watchdog('user', 'Flood control blocked login attempt from %ip.', array('%ip' => $ip));
  }
}
