Skip to:
Content

Opened 2 years ago

Closed 2 years ago

#7045 closed defect (bug)

Emails: Allow a custom `unsubscribe` token to be set directly in `bp_send_email()`

Reported by: r-a-y Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.0
Component: Emails Keywords: commit
Cc:

Description

There may be instances where a dev will want to use bp_send_email() with a custom {{unsubscribe}} link.

Unfortunately, at the moment, doing something like the following will not work:

bp_send_email( $email_type, 'email@address.com', array(
        'tokens' => array(
                'unsubscribe' => 'CUSTOM LINK'
        )
) );

Attached patch allows this and also adds a Settings component check to the default unsubscribe link.

Attachments (1)

7045.01.patch (1.3 KB) - added by r-a-y 2 years ago.

Download all attachments as: .zip

Change History (7)

#1 @DJPaul
2 years ago

Please be aware of #6932 for 2.6 which also achieves what you want here. 2.6 emails will have a custom unsubscribe link for each type of email. But, no reason why this change can't get into 2.5.3. This behaviour wasn't desired.

If you've added bp_is_active, the existing function_exists becomes redundant, right?

#2 @r-a-y
2 years ago

  • Milestone changed from 2.5.3 to 2.6

Please be aware of #6932 for 2.6 which also achieves what you want here.

While #6932 is great, it only works for BP core emails.

But, no reason why this change can't get into 2.5.3.

I might be able to workaround this another way. I'm going to hold off on this for 2.6 and let tharsheblows finish work on global unsubscribe functionality before I look into this again.

If you've added bp_is_active, the existing function_exists becomes redundant, right?

Ah yes, good catch! 01.patch is updated.

@r-a-y
2 years ago

#3 @tharsheblows
2 years ago

This doesn't overwrite #6932 I don't think. This sets a default unsubscribe link if one's not already there so they should work together, well at least the last patch I did should be like that. The one comment I have is that some emails cannot be unsubscribed from, so you might want to not put an unsubscribe link on those.

I did #6932 with the idea that you can extend it -- it's just an idea in my head at the moment though. Plugin developers could filter the schemas to add the necessary and then use #7036 to generate the email post then go from there.

#4 @DJPaul
2 years ago

  • Keywords commit added

@r-a-y I think you can commit this.

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


2 years ago

#6 @r-a-y
2 years ago

  • Milestone 2.6 deleted
  • Status changed from new to closed

@tharsheblows mentioned she added my changes into #6932, so I think this can be closed for that one.

Note: See TracTickets for help on using tickets.