- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for reporting this problem, and sorry it took a while to get back to you.
As you are probably aware, this is a really tricky problem, where it seems there are no solutions that work for everyone. An alter hook therefore could make sense. However, we don’t use hooks in this module anymore (all existing ones have been deprecated, see #3023704: Convert hooks to events → ), so we’d provide an event for this instead. (Also, just for your information, there is
\Drupal::moduleHandler()->alter()
for alter hooks, no need to manually pass an array with a reference toinvokeAll()
.)However, it seems like this could also be solved by having an alternative when configuring the field to specify a user ID instead of the roles? Or what else would you put into your alter hook implementation (resp. event listener)? Code that looks up a user with the correct roles?
Setting a fixed user ID is, of course, also not ideal, since that user’s roles can change (though I would of course advise on adding a special user just for that). But as an optional alternative, it might solve a few users’ problems with this.