function hook_user_flood_control in Drupal 7
Respond to user flood control events.
This hook allows you 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.
Parameters
$ip: The IP address that triggered flood control.
$username: The username that has been temporarily blocked.
See also
Related topics
2 functions implement hook_user_flood_control()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- user_flood_test_user_flood_control in modules/
user/ tests/ user_flood_test.module - Implements hook_user_flood_control().
- user_user_flood_control in modules/
user/ user.module - Implements hook_user_flood_control().
1 invocation of hook_user_flood_control()
- user_login_final_validate in modules/
user/ user.module - The final validation handler on the login form.
File
- modules/
user/ user.api.php, line 489 - 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.
// Drupal 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.
// Drupal core uses this hook to log the event:
watchdog('user', 'Flood control blocked login attempt from %ip.', array(
'%ip' => $ip,
));
}
}