Skip to:
Content

BuddyPress.org

Changeset 11411


Ignore:
Timestamp:
02/06/2017 12:36:22 PM (3 years ago)
Author:
djpaul
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r11401 r11411  
    36693669 */
    36703670function bp_email_unsubscribe_handler() {
    3671     $emails         = bp_email_get_type_schema( 'all' );
     3671    $emails         = bp_email_get_unsubscribe_type_schema();
    36723672    $raw_email_type = ! empty( $_GET['nt'] ) ? $_GET['nt'] : '';
    36733673    $raw_hash       = ! empty( $_GET['nh'] ) ? $_GET['nh'] : '';
     
    37503750 */
    37513751function bp_email_get_unsubscribe_link( $args ) {
    3752     $emails = bp_email_get_type_schema( 'all' );
     3752    $emails = bp_email_get_unsubscribe_type_schema();
    37533753
    37543754    if ( empty( $args['notification_type'] ) || ! array_key_exists( $args['notification_type'], $emails ) ) {
     
    37933793    return bp_get_option( 'bp-emails-unsubscribe-salt', null );
    37943794}
     3795
     3796/**
     3797 * Get a list of emails for use in our unsubscribe functions.
     3798 *
     3799 * @since 2.8.0
     3800 *
     3801 * @see https://buddypress.trac.wordpress.org/ticket/7431
     3802 *
     3803 * @return array The array of email types and their schema.
     3804 */
     3805function bp_email_get_unsubscribe_type_schema() {
     3806    $emails = bp_email_get_type_schema( 'all' );
     3807
     3808    /**
     3809     * Filters the return of `bp_email_get_type_schema( 'all' )` for use with
     3810     * our unsubscribe functionality.
     3811     *
     3812     * @since 2.8.0
     3813     *
     3814     * @param array $emails The array of email types and their schema.
     3815     */
     3816    return (array) apply_filters( 'bp_email_get_unsubscribe_type_schema', $emails );
     3817}
Note: See TracChangeset for help on using the changeset viewer.