New answers tagged

1

I'm not sure you can do that in one query only but I might be wrong. Using two queries, you could do the following: {# Fetch users from the group you don't want to display #} {% set usersToExclude = craft .users() .group('groupToExclude') .ids() %} {# Built an array of ids to exclude adding 'not' to it #} {% set exclusionList = ['not'] | merge(...


3

If you are faced with such a task, then I think it's better to use user IDs, getting from the method a ids from the field in which users are stored, and check the received array using the in method. Another option is a plugin https://plugins.craftcms.com/user-group-field. {% set usersIds = entry.usersField.ids %} {% if currentUser.id in usersIds %} ...


Top 50 recent answers are included