Skip to main content
added 28 characters in body
Source Link
Brad Bell
  • 67.6k
  • 6
  • 75
  • 145

Please could you advise on how to filter a user query, so that users from Group A are included, but not if they are also in Group B?

{% set vnp_users = craft.users .group(['groupA', 'not groupB']) .orderBy('field desc') .all() %}

{% set vnp_users = craft.users
    .group(['groupA', 'not groupB'])
    .orderBy('field desc')
    .all() %}

Please could you advise on how to filter a user query, so that users from Group A are included, but not if they are also in Group B?

{% set vnp_users = craft.users .group(['groupA', 'not groupB']) .orderBy('field desc') .all() %}

Please could you advise on how to filter a user query, so that users from Group A are included, but not if they are also in Group B?

{% set vnp_users = craft.users
    .group(['groupA', 'not groupB'])
    .orderBy('field desc')
    .all() %}
Source Link

Filter users: in group AND not in other group

Please could you advise on how to filter a user query, so that users from Group A are included, but not if they are also in Group B?

{% set vnp_users = craft.users .group(['groupA', 'not groupB']) .orderBy('field desc') .all() %}