diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php
index 1b285555c..85a8978d2 100644
|
|
function bp_email_set_default_headers( $headers, $property, $transform, $email ) |
1074 | 1074 | 'user_id' => $user_id, |
1075 | 1075 | 'notification_type' => $email->get( 'type' ), |
1076 | 1076 | ); |
1077 | | // If this email is not to a current member, include the nonmember's email address. |
| 1077 | |
| 1078 | // If this email is not to a current member, include the nonmember's email address and the Inviter ID. |
1078 | 1079 | if ( ! $user_id ) { |
1079 | 1080 | $args['email_address'] = $tokens['recipient.email']; |
| 1081 | $args['member_id'] = bp_loggedin_user_id(); |
1080 | 1082 | } |
1081 | 1083 | |
1082 | 1084 | $link = bp_email_get_unsubscribe_link( $args ); |
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index 98b46f5ce..0ad97989d 100644
|
|
function bp_email_get_type_schema( $field = 'description' ) { |
4027 | 4027 | 'description' => __( 'A site member has sent a site invitation to the recipient.', 'buddypress' ), |
4028 | 4028 | 'unsubscribe' => array( |
4029 | 4029 | 'meta_key' => 'notification_bp_members_invite', |
4030 | | 'message' => __( 'You will no longer receive emails when you are invited to join a site.', 'buddypress' ), |
| 4030 | 'message' => __( 'You will no longer receive emails when you are invited to join this site.', 'buddypress' ), |
4031 | 4031 | ), |
4032 | 4032 | ); |
4033 | 4033 | |
… |
… |
function bp_email_unsubscribe_handler() { |
4071 | 4071 | $raw_user_id = ! empty( $_GET['uid'] ) ? absint( $_GET['uid'] ) : 0; |
4072 | 4072 | $raw_user_email = ! empty( $_GET['uem'] ) ? $_GET['uem'] : ''; |
4073 | 4073 | $raw_member_id = ! empty( $_GET['mid'] ) ? absint( $_GET['mid'] ) : 0; |
| 4074 | $redirect_to = ''; |
4074 | 4075 | |
4075 | 4076 | $new_hash = ''; |
4076 | 4077 | if ( ! empty( $raw_user_id ) ) { |
… |
… |
function bp_email_unsubscribe_handler() { |
4116 | 4117 | 'email_type' => $raw_email_type, |
4117 | 4118 | 'date_modified' => bp_core_current_time(), |
4118 | 4119 | ); |
4119 | | $result = bp_add_optout( $optout_args ); |
4120 | | $redirect_to = home_url(); |
4121 | | $result_msg = $emails[ $raw_email_type ]['unsubscribe']['message']; |
4122 | | $unsub_msg = __( 'You have been unsubscribed.', 'buddypress' ); |
| 4120 | $result = bp_add_optout( $optout_args ); |
| 4121 | $result_msg = $emails[ $raw_email_type ]['unsubscribe']['message']; |
| 4122 | $unsub_msg = __( 'You have been unsubscribed.', 'buddypress' ); |
4123 | 4123 | |
4124 | 4124 | // This is an unsubscribe request from a current member. |
4125 | 4125 | } else { |
… |
… |
function bp_email_unsubscribe_handler() { |
4141 | 4141 | $unsub_msg = __( 'You can change this or any other email notification preferences in your email settings.', 'buddypress' ); |
4142 | 4142 | } |
4143 | 4143 | |
4144 | | $message = sprintf( |
4145 | | '%1$s <a href="%2$s">%3$s</a>', |
4146 | | $result_msg, |
4147 | | esc_url( $redirect_to ), |
4148 | | esc_html( $unsub_msg ) |
4149 | | ); |
| 4144 | if ( $raw_user_id && $redirect_to ) { |
| 4145 | $message = sprintf( |
| 4146 | '%1$s <a href="%2$s">%3$s</a>', |
| 4147 | $result_msg, |
| 4148 | esc_url( $redirect_to ), |
| 4149 | esc_html( $unsub_msg ) |
| 4150 | ); |
4150 | 4151 | |
4151 | | bp_core_add_message( $message ); |
| 4152 | // Template notices are only displayed on BP pages. |
| 4153 | bp_core_add_message( $message ); |
| 4154 | bp_core_redirect( bp_core_get_user_domain( $raw_user_id ) ); |
4152 | 4155 | |
4153 | | $page_redirect = ''; |
4154 | | if ( $raw_user_id ) { |
4155 | | $page_redirect = bp_core_get_user_domain( $raw_user_id ); |
| 4156 | exit; |
| 4157 | } else { |
| 4158 | wp_die( |
| 4159 | sprintf( '%1$s %2$s', esc_html( $unsub_msg ), esc_html( $result_msg ) ), |
| 4160 | esc_html( $unsub_msg ), |
| 4161 | array( |
| 4162 | 'link_url' => home_url(), |
| 4163 | 'link_text' => __( 'Go to website\'s home page.', 'buddypress' ), |
| 4164 | ) |
| 4165 | ); |
4156 | 4166 | } |
4157 | | |
4158 | | bp_core_redirect( $page_redirect ); |
4159 | | |
4160 | | exit; |
4161 | 4167 | } |
4162 | 4168 | |
4163 | 4169 | /** |