Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

#7431 closed enhancement (fixed)

Hook for custom email type schema

Reported by: finzend's profile finzend Owned by: djpaul's profile DJPaul
Milestone: 2.8 Priority: high
Severity: blocker Version: 2.7.2
Component: Emails Keywords: has-patch
Cc:

Description

Hi,

I have added a custom notification (for a custom post type) including a new setting in the e-mail notification screen, so users can get alerted by email. I've added the new bp-email template and everything worked fine, except the 'new' unsubscribe link from #6932
The link is generated by a user_id and a notification type. This type is looked up via the function bp_email_get_type_schema.

It seemed I had to add a type to bp_email_get_type_schema, after that the unsubscribe link worked. But I had to update/change the code in bp-core-functions, because there wasnt any hook available. Could such a hook/action be implemented?

Attachments (1)

7431.01.patch (1.7 KB) - added by thebrandonallen 8 years ago.

Download all attachments as: .zip

Change History (6)

#1 @DJPaul
8 years ago

  • Component changed from Core to Emails
  • Milestone changed from Awaiting Review to 2.8
  • Owner set to DJPaul
  • Priority changed from normal to high
  • Severity changed from normal to blocker

Hi. Er, gosh. You're correct. We'll have to think about this quickly.

The problem with adding a filter to bp_email_get_type_schema (though this is likely the best way to go) will mean that your custom emails will get installed via the call at the top of the bp_core_install_emails function. We've been telling people to use the bp_core_install_emails action to install their emails... so will need to introduce some kind of internal-only flag to prevent this happening.

Thank you very much for letting us know @finzend !

#2 @thebrandonallen
8 years ago

  • Keywords has-patch added

We've been telling people to use the bp_core_install_emails action to install their emails... so will need to introduce some kind of internal-only flag to prevent this happening.

Attached patch may be shortsighted, but it would allow the schema to be filtered for unsubscribe functions without interfering with current/recommended install procedures or unnecessarily complicating bp_email_get_type_schema().

This ticket was mentioned in Slack in #buddypress by slaffik. View the logs.


8 years ago

#4 @DJPaul
8 years ago

@thebrandonallen Your patch looks a good way to fix this problem for 2.8 without lots of internal changes this late, I agree. The patch itself is literally perfect and done to a very high standard, so: thank you. :)

#5 @djpaul
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 11411:

Emails: fix "unsubscribe" functionality for 3rd-party emails.

Adds new filterable function allowing the return from bp_email_get_type_schema() to be appended with unsubscribe data for custom email types.

Fixes #7431

Props thebrandonallen, finzend

Note: See TracTickets for help on using tickets.