I've enabled Simplenews Actions, and go to Home » Administer » Site building » Triggers and find:

Trigger: After a user has been subscribed
No available actions for this trigger.
Trigger: After a user has been unsubscribed
No available actions for this trigger.

Is this right?

CommentFileSizeAuthor
#17 simplenews.308922.patch1.11 KBsutharsan

Comments

niklp’s picture

I'm not absolutely certain, but I think the point of "_actions" module extensions is to make triggers available TO the actions bit. So, really, all this extension module does is provide the triggers. You have to write the actions yourself (although I would hope that you can add advanced ones manually also, but not sure).

sutharsan’s picture

Status: Active » Fixed

NikLP is right in his explanation. Simplenews provides you with actions and triggers. You have to add actions to the triggers yourselves. That's part of the flexibility actions and triggers provide.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

duntuk’s picture

Status: Closed (fixed) » Active

i just checked this out with the latest build of simplenews, and can confirm the there are no available actions, or ways of making trigers for the newsletter module.

e.g.

There should be a way to notify the admin that a user has subscribed to the newsletter--the email should be able to show the subscriber's email (and other user info if available) .... <-- there's currently no way i see of doing this.

sutharsan’s picture

You need to write code for actions to act upon simplenews triggers.

sutharsan’s picture

Status: Active » Closed (fixed)

No activity. Closing the issue.

nicorac’s picture

Status: Closed (fixed) » Active

@Sutharsan: Sorry, but I can't get the point...

Using 6.x-1.0-rc6.

If I open page admin/build/trigger/simplenews, I see two boxes:
- Trigger: After a user has been subscribed
- Trigger: After a user has been unsubscribed

both of them show:
No available actions for this trigger.

Aren't these supposed to contain a dropdown list with, at least, system actions like "send an email"?

If I'm wrong, could you please explain what you mean in #5 ?

Thanks
Claudio

donquixote’s picture

subscribing.

A typical action one would like to fire is notification emails for the list manager.
1) Subscription notification? - redundant because of
2) Notify Admin of Subscribe/Unsubscribe (for a short time the title was "Port to Drupal 5")

joachim’s picture

Title: No subscribe/unsubscribe actions available » Make core actions available to simplenews triggers
Category: support » feature
Status: Active » Needs review

We need to tell core actions that they may apply to simplenews triggers:

/**
 * Implementation of hook_action_info_alter().
 */
function simplenews_action_info_alter(&$actions) {
  foreach ($actions as $id => $action) {
    if ($action['type'] == 'user') {
      $actions[$id]['hooks']['simplenews'] = array('subscribe', 'unsubscribe');
    } 
  }
}

Add the above code to the module and user actions become available.
I've just tested this by blocking a user when they unsubscribe.
I expect other system actions can be enabled here too -- not sure which ones are relevant.

pcorbett’s picture

Version: 7.x-1.x-dev » 6.x-1.0-rc6
Status: Needs review » Reviewed & tested by the community

This should totally be committed. It's kinda silly to include actions support, but then not be able to use it :)

Is there a reason why this is restricted to $action['type'] == 'user' ?? I commented out the IF statement and am successfully using the "Redirect URL" action once a user has subscribed to a newsletter (trigger).

joachim’s picture

Not every single action type will be relevant, because it might not have a user to operate on.
So $action['type'] could be 'user' OR some other things... I don't know enough about actions to say.

Anonymous’s picture

I actually achieved this using the Trigger Unlock module - http://drupal.org/project/triggerunlock

You can then set up an action (i.e. Send email...) and the Trigger Unlock module allows you to assign any Action to any Trigger. So on Home » Administer » Site building » Triggers, instead of "No available actions for this trigger." you will be able to assign any action to the 'Subscribe' or 'Unsubscribe' Trigger.

Joel MMCC’s picture

How about supporting the Rules module, which is a much more powerful replacement for the Triggers Module? At present, I cannot install Simplenews_actions without enabling Trigger, even though I have Rules enabled and it’s an upwardly API-compatible drop-in replacement for Trigger, and both cannot be enabled at the same time without causing problems.

Should this be a separate Issue?

joachim’s picture

@Joel MMCC: I'm not a maintainer, but I would say yes, file a new issue for Rules support.

sutharsan’s picture

Please supply a patch for Rules support (and I am the maintainer ;) )

sutharsan’s picture

Version: 6.x-1.0-rc6 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

I've committed #9 code by joachim. I've also added pcorbett's suggestion and included the 'system' type actions. It will be available in the next to 6.x-2.x-dev release.

sutharsan’s picture

StatusFileSize
new1.11 KB

For the record...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.