drupal-eca-recipe/eca_lib_0029

Add role to inserted or updated user

Installs: 40

Dependents: 0

Suggesters: 0

Security: 0

Type:drupal-recipe

3.3.2 2025-08-10 14:12 UTC

This package is auto-updated.

Last update: 2025-08-10 14:14:47 UTC


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/{{ rawid }}

# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0029

# Rebuilding caches is optional, sometimes required:
drush cr