drupal-eca-recipe / eca_lib_0010
Detect user role changes
3.2.1
2025-08-03 11:21 UTC
Requires
- drupal/core: >=11.2
- drupal/eca: ^3
README
ID: eca_lib_0010
When a user entity gets saved, this model compares the list of original and current roles of that user and finds out, which ones got added and which ones got removed.
This involves 2 loops where we first go through the list of current roles to see if one of them is missing from the list of original roles. Then we gro through the list of original roles to see if ones of them is missing in the list of current roles.
For each missing role, this model shows a message on screen.
Installation
## Import recipe
composer require drupal-eca-recipe/eca_lib_0010
# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/{{ rawid }}
# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0010
# Rebuilding caches is optional, sometimes required:
drush cr