Jump to content
Tyssen

Subscribe to updates

Recommended Posts

Does anything exist within PW for people to be able to subscribe to updates? So you enter your email address and when new blog posts are published, you get an email alert? And I guess there also needs to be a way for people to unsubscribe too.

Does anything exist like that for PW?

Share this post


Link to post
Share on other sites

So is the idea to use Mailchimp's RSS to email feature?

Share this post


Link to post
Share on other sites
14 minutes ago, Tyssen said:

So is the idea to use Mailchimp's RSS to email feature?

You can read more about it here:

 

Share this post


Link to post
Share on other sites

I can see that you can use the module to add subscribers to a Mailchimp list, but it seems like you could just use a Mailchimp form to do that. I'm not seeing anything in there about there being a link between publishing content in Processwire and then subscribers receiving emails about that event.

Share this post


Link to post
Share on other sites
21 minutes ago, Tyssen said:

I'm not seeing anything in there about there being a link between publishing content in Processwire and then subscribers receiving emails about that event.

I see. There seems to be nothing presently that suits your needs then (but others can chime in). If that's the case, you can roll your own. A most basic one would consist of two parts. 

  1. Publishing a post: A hook to monitor this event (e.g. in ready.php) should do the trick. You could send the emails right within the hook. How and when you do it depends on how many emails you have to send.
  2. Subscribe/Unsubscribe: There is a module, I think for email subscriptions? If not you would have to store this somewhere. Ryan wrote about this somewhere, how he does it with ProcessWire weekly newsletters. I think they are just pages.

Share this post


Link to post
Share on other sites

Maybe the ProMailer can help out?

Quote

ProMailer is the ideal tool for creating and sending email newsletters and managing subscribers in ProcessWire.

 

  • Like 2

Share this post


Link to post
Share on other sites
3 minutes ago, horst said:

Maybe the ProMailer can help out?

How could I forget this? Hehe. Thanks for the reminder 😄 

  • Like 1

Share this post


Link to post
Share on other sites

So would that still be using a webhook as described in #1 by @kongondo above and using ProMailer for #2? Or does the triggering of emails when pages are published exist in ProMailer already?

Share this post


Link to post
Share on other sites
18 minutes ago, Tyssen said:

So would that still be using a webhook as described in #1 by @kongondo above and using ProMailer for #2? Or does the triggering of emails when pages are published exist in ProMailer already?

I think you still need #1, but that's the easy bit 😄 

https://processwire.com/store/pro-mailer/

Share this post


Link to post
Share on other sites

So in ready.php it would be something like this?

wire()->addHookAfter('Pages::published', function($event) {
    $page = $event->arguments('page');

    $t = wire()->templates->get($page->template);
    if($t->name == 'blog') {
        // what goes here?
    }   
    $event->return = $page;
});

 

Share this post


Link to post
Share on other sites

Something like this...

wire()->addHookAfter('Pages::published', function($event) {    
 	$page = $event->arguments(0);
    if($page->template !='blog-post' ) return;
	// ProMailer API TO SEND EMAILS 
   	// no need to return $event if you haven't modified it
});

Talk to Ryan about ProMailer API if what you need does not exist here

https://processwire.com/api/ref/pro-mailer/

Share this post


Link to post
Share on other sites

Where's the place to post Promailer questions before purchasing the module? @ryan

Share this post


Link to post
Share on other sites

Depending on the situation (how many subscribers etc) this could be really simple to implement on your own:

  1. A form that subscribes an email to the current page (using $page->meta('subscribers') for example)
  2. A hook that sends an email on every publish of a child of the subscribed page (using WireMail)
  3. A magic link in every email to unsubscribe (eg unsubscribe section or unsubscribe all)

It get's more complicated of course if you got a larger number of subscribers or you need to deal with legal stuff (opt-in, mail confirmation links etc) - but sometimes simple solutions are totally fine (eg if you only have a handful of trusted users)...

Share this post


Link to post
Share on other sites

@bernhard Presumably the hook for #2 could look the same as the one @kongondo wrote above? It doesn't necessarily need to be a child of a particular page, but instead match a template. And for #3, what would the magic link look like, how would it be generated?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...