Hey,
A lightswitch field was added to the user profile to control permissions for sending emails.
I then query all user IDs that have opted out and use the skipMessage tag in the corresponding template.
`
{# get users with switched off notifications #}
{% set userQuery = craft.users()
.notifyNewPositions(0)
.limit(null)
%}
{# get ids of them #}
{% set users = userQuery.all() %}
{% set recipientIds %}
{% for user in users %}
{{ user.id }}{% if not loop.last %}, {% endif %}
{% endfor %}
{% endset %}
{# skip message if notifications are off #}
{% if recipient.user.id in recipientIds %}
{% skipMessage "User is not an intended recipient." %}
{% endif %}
`
So far, so good, the query does retrieve the correct IDs, but I’m still seeing duplicate emails.
Unfortunately, it seems like the skipMessage concept is being ignored.
Any advice?


Hey,
A lightswitch field was added to the user profile to control permissions for sending emails.
I then query all user IDs that have opted out and use the skipMessage tag in the corresponding template.
`
{# get users with switched off notifications #}
{% set userQuery = craft.users()
.notifyNewPositions(0)
.limit(null)
%}
{# get ids of them #}
{% set users = userQuery.all() %}
{% set recipientIds %}
{% for user in users %}
{{ user.id }}{% if not loop.last %}, {% endif %}
{% endfor %}
{% endset %}
{# skip message if notifications are off #}
{% if recipient.user.id in recipientIds %}
{% skipMessage "User is not an intended recipient." %}
{% endif %}
`
So far, so good, the query does retrieve the correct IDs, but I’m still seeing duplicate emails.
Unfortunately, it seems like the skipMessage concept is being ignored.
Any advice?