function ip_login_user_update in IP Login 4.x
Same name and namespace in other branches
- 7.2 ip_login.module \ip_login_user_update()
Implements hook_ENTITY_TYPE_update() for the 'user' entity type.
File
- ./
ip_login.module, line 72 - Hooks for the IP login module.
Code
function ip_login_user_update(UserInterface $user) {
// Invalidate the 'ip_login' cache tag whenever the 'IP Address' field of a
// user entity has changed.
$field_name = 'ip_login';
if (!$user
->get($field_name)
->equals($user->original
->get($field_name))) {
\Drupal::service('cache_tags.invalidator')
->invalidateTags([
'ip_login',
]);
}
}