2

One of my Drupal sites has a bunch of Rules set up to send email notifications to various roles when certain things happen on the site (new content added, etc.)

Is it possible for one of the site users to change a setting in their profile so that they won't get sent these notification emails?

I know that in the user account profile, you can uncheck the box for the personal contact form - but does that have any effect on getting emails sent by the System or by Rules processes?

Clarification: I actually don't want users to be able to opt out. I'm trying to investigate if they have a way to do that because I don't want them to.

3

Unchecking the box for the contact form only affects the personal contact form provided by the Contact module (part of Core).

I added a similar feature (allow users to opt out to e-mails sent via rules) to a Drupal 7 site in the following manner.

First, I added a field (Boolean single on/off checkbox) labeled "Send me notifications" to the user account page.

Then, I made a couple rules to award a role nomsg upon checking the box and to remove the role upon unchecking the box.

After that, I created a rules component of type condition that checked to ensure that the user did NOT have the nomsg role. I then added that component to all rules that sent e-mails. This was a bit of a pain, because some of the rules that sent e-mails also did other things, so I had to break out the part about sending the e-mail (as another component) so that the other actions would be performed but the e-mail would not be sent if the user had the nomsg role.

  • Let me clarify - I actually don't want users to be able to opt out. I'm trying to investigate if they have a way to do that because I don't want them to. Thanks – David Csonka May 10 '13 at 15:59
  • 1
    Ok, in that case the answer is simple-- no, the Rules module itself does not provide a way to opt out, nor does any of the core modules affect mail sent by rules. If you want them to be able to opt out, you have to create the option yourself, as I described in my answer. If you don't want to give them that your choice, then you don't need to do anything; there will be no way for them to opt out. – Patrick Kenny May 11 '13 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.