#4776 closed enhancement
Allow email notifications to be hooked/filtered
Reported by: | cklosows | Owned by: | DJPaul |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Toolbar & Notifications | Keywords: | |
Cc: | cklosowski@…, vivek@… |
Description
There's a use case I'm running into where I'd prefer to always send notifications via a push service.
This service isn't email based and overloading wp_mail doesn't offer the ability to get details such as user_id, the exact details of the notification and the ability to overload the users preference.
I'm looking for some feedback if something like this would be a viable option to have a user state they want to receive notifications, yet not send them via email.
The goal in this change is:
Be able to identify, prior to the email being sent, if the user wants to receive a notification and if so, execute this other notification service on the filter 'bp_activity_at_message_notification_preference'. This would allow me to gracefully degrade to sending the email if the user doesn't have the proper configuration for the 3rd party service (api key) or the service fails in general, by returning their preference unchanged. If however the service does succeed during the execution of that filter, I can return 'no', essentially leaving only the 1 notification instead of 2 (email and service)
If this is viable, I'd like to make these updates to each notification email function.
Attachments (1)
Change History (8)
#1
@
12 years ago
- Keywords dev-feedback 2nd-opinion removed
- Milestone changed from Awaiting Review to Future Release
Something I've wanted to do for a long time is create a class that encapsulates the entire email, so that it's possible to have common filters and action to allow things like this, without having to re-implement it each time we get BP to send an email.
#2
@
12 years ago
@DJPaul,
I'm up for helping write this. I like that idea. Something like
$send_email = new BP_Mail($to, $from, $subject, $body, $headers);
The class can have the actions and filters to handle the entire logic and then people could decide from that single set of hooks to send email using wp_mail() or use something else to use for notifications.
Am I getting the high level of what you were thinking?
Edit: Just thinking, we'd also need something to help identify what 'action' this was, (accepted friendship, requested friendship, join group, new message, etc)
#5
@
9 years ago
- Keywords has-patch needs-testing 2nd-opinion removed
- Milestone changed from Future Release to 2.4
- Owner set to DJPaul
- Status changed from new to assigned
I'm looking at emails for 2.4 and this is something I hadn't thought of. Assigning to self so can remember later.
Initial idea for feedback