drupal-eca-recipe / eca_lib_0029
Adds a role to a user on insert or update, comparing three possible approaches and showing why only one of them is reliable.
Package info
gitlab.lakedrops.com/drupal/recipes/eca_lib_0029
Type:drupal-recipe
pkg:composer/drupal-eca-recipe/eca_lib_0029
Requires
- drupal/eca: *
- drupal/modeler_api: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
ID: eca_lib_0029
This model demonstrates how to add a role to an inserted or updated user entity. There are actually 3 potential ways of doing this, only 1 of them being recommended. The recorded session (see link below) shows the issues you can run into when choosing one of the other options and it may become transparent, why the third option is the best of the available ones.
The creation of this module was recorded and the video with additional explanations can be watched here.
Installation
## Import recipe
composer require drupal-eca-recipe/eca_lib_0029
# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/eca_lib_0029
# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0029
# Rebuilding caches is optional, sometimes required:
drush cr