Community Documentation

How to add notifications of subscriptions in Simplenews

Last updated November 8, 2012. Created by reptilex on November 8, 2012.
Log in to edit this page.

For this to work you have to have:

  • Rules Module enabled
  • and Rules UI enabled (this comes with rules)
  • and simplenews rules enabled (this comes with simplenews)

After that you may want to add a new role for the people you want to be notified, but you can just choose any rol like the administrator role.

  1. Go to [[yoursite]]/admin/config/workflow/rules and add a new rule. Give it a name, then choose "A user has been subscribed " from the simplenews events and set that for "React on event". And save it
  2. Add an action for this rule, choose "send mail for all users in a role". And choose the role you want to be notified
  3. Under subject add something like: New Subscription from <?php echo $mail; ?> for simplenews category <?php echo $tid; ?>
  4. Under message add something like: A new subscriber with the email <?php echo $mail; ?> for the simplenews category <?php echo $tid; ?> has been added for your site <?php echo $site; ?>. Be happy.
  5. save

Next time someone subscribes you will get an email. Now go and do the same for unsubscribe. Remember to use the event "A user has been unsubscribed" and use the proper wording in the email fields. This should do the trick.

You might be able to exchange the embedded php code with tokens, but this depends on the modules you have enabled in your installation.

Comments

Hi this is fine for people

Hi
this is fine for people subscribing from the subscription block, but how to avoid receiving the mail everytime we subscribe people manually with the mass subscricption form?
Simone

Hi Simone,
it seems you don't do a mass subscription every day do you? So why not just create the rule for the manual form and everytime you do a mass subscription simply deactivate the rule for the time you do the mass subscription and reactivate it again.
If you do this daily than it might be a hassle, so you could add an extra condition where you state that this rule should ignore the user doing the mass subscriptions.

I did this by adding a

I did this by adding a condition that the User role should NOT be 'administrator'.

I tested the rule and it does indeed not send me the email notice if the person mass subscribing has the 'administrator' role.

You could, of course, amend this to include any role you like.

This would only be a problem if you have other administrators and you would like to know if they (un)subscribe but you could get around this by creating another role only for yourself and exclude that role instead.

Page status

Needs copy/style review

Log in to edit this page

About this page

Drupal version
Drupal 7.x
Audience
Programmers, Site administrators, Site builders
Level
Intermediate
Keywords
simplenews notifications

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.