E-mail relevant users when a new post is created

Morning,

Is it possible to set s2Member up in such a way that when a new Post is created, users receive an e-mail notification?

I know this is possible with other plugins, but I’d like it so that users who see Post X (available only to Subscription level 1 users) will also receive an e-mail. Those users on Subscription 0 won’t. Same idea with Subscription level 4 - only those users will receive an e-mail when such a Post is created.

Thanks in advance,
Duncan

Anything is possible, but this is not possible without significant custom code. I’ve never tried to make s2Member watch for new Posts (it is not its function). It might even be easier to modify a plugin that sends emails about new Posts to differentiate between User Roles and recognize s2Member restrictions. There may even be a plugin out there that can already differentiate between User Roles when sending these emails, I have no idea. It’s not impossible, but neither is anything I’ve done before so I have no samples or tips for getting started.

Why are you averse to using other plugins? You should use the tool best suited to the task. This is a task for a dedicated plugin, and not for s2Member.

If all your posts are created in the admin pages, you can achieve precisely what you want with Better Notifications for WordPress: https://wordpress.org/plugins/bnfw/

1 Like

Hi Tim,

Ah sorry, I don’t know if I worded the OP poorly but I’m definitely not averse to using other plugins - I just didn’t know if something like BNFW would respect S2Member’s restriction levels.

My requirements aren’t overly complicated. I just want every new Post to also send an e-mail notification. However, I only want the relevant users to receive this e-mail.

If a new Post is created for Subscription level 2 users, those users with level 1 or 0 subscriptions should not receive an e-mail notification.

Do you think BNFW would do this out of the box?

I’m actually no stranger to customising WP plugins and I’m a PHP dev by trade, so also not averse to modifying a plugin if needed. I’d much rather not do this though, for future-proofing reasons.

I KNOW it can do that out of the box! I have been using it for years!

The one proviso is that the posts must be created in the admin pages. If you want it to work with front-end submissions too, then it will need customization.

Nope, no need for front-end stuff, admin is totally fine :slight_smile:

That’s great news then - just as simple as installing the plugin and letting the two plugins work their magic independently?

EDIT

I’ve just installed BNFW Tim. Could you please clarify how it works? Apologies this is somewhat OT but might be useful for others in the future.

I can see how to set up a new Notification for when a new Post is published. However, the Notification is asking me to choose the s2Member Subscriber level as part of the Notification. If I pick S1, won’t that mean that every Post I create will just be e-mailed to my Subscriber level 1 members?

I was hoping that I could set it up so that when I create a Post which is only visible to Subscriber level 1 users (either by the Post-specific restrictions or by the category restriction system we use), it would then e-mail all of those affected users. I can’t see a way to seet BNFW up like that?

Annnnd another edit. I think I’ve answered my own question:

https://betternotificationsforwp.com/downloads/conditional-notifications/

Alternatively, you can have a different custom post type for each member level.