Add role to inserted or updated user¶
Version v1
Purpose¶
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.
Dependencies¶
- config
- node.type.article
- node.type.page
- taxonomy.vocabulary.tags
- user.role.content_editor
- module
- comment
- contextual
- eca_base
- eca_content
- eca_user
- file
- node
- path
- system
- taxonomy
- toolbar
- tour
- user
Used plugins¶
Events¶
- Presave content entity (User: - any -)
- Insert content entity (User: - any -)
- Update content entity (User: - any -)
Conditions¶
Actions¶
- Switch to user 1
- Load saved user entity
- Add role "content editor"
- Print success message
- Add role to field
- Print fail message
Changelog¶
v1
-
Initial version
Last update:
September 22, 2023 15:16:04