Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#4776 closed enhancement

Allow email notifications to be hooked/filtered

Reported by: cklosows's profile cklosows Owned by: djpaul's profile 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)

4776.patch (1.0 KB) - added by cklosows 12 years ago.
Initial idea for feedback

Download all attachments as: .zip

Change History (8)

@cklosows
12 years ago

Initial idea for feedback

#1 @DJPaul
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 @cklosows
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)

Last edited 12 years ago by cklosows (previous) (diff)

#3 @cklosows
12 years ago

  • Cc cklosowski@… added

#4 @sooskriszta
10 years ago

  • Cc vivek@… added
  • Keywords has-patch needs-testing 2nd-opinion added

#5 @DJPaul
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.

#6 @DJPaul
9 years ago

  • Milestone 2.4 deleted
  • Status changed from assigned to closed

Closing in favour of #6592. Everything said here will be taken into account. Come join the party!

#7 @DJPaul
9 years ago

@cklosows If you're still interested, I'd appreciate if you could check the recent updates on #6592 and let me know if you think what's been built would let you do what you've described in this ticket. :)

Note: See TracTickets for help on using tickets.