Skip to content

Duplicate emails sent #26

Description

@redkrupp

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?

Image

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions