Skip to:
Content

BuddyPress.org

Changeset 7463


Ignore:
Timestamp:
10/23/2013 07:35:37 AM (11 years ago)
Author:
r-a-y
Message:

Remove unnecessary email headers in multisite activation emails.

BuddyPress does not set email headers for single-site activation emails,
so the same thing should occur for multisite.

Fixes issue with setting the 'MIME-Version' header twice, which could
result in the activation email being rejected in some cases.

Fixes #5186.

Props ryderlewis. See #WP22492.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-filters.php

    r7446 r7463  
    264264function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
    265265
    266     // Send email with activation link.
     266    // Set up activation link
    267267    $activate_url = bp_get_activation_page() ."?key=$key";
    268268    $activate_url = esc_url( $activate_url );
    269269
    270     $admin_email = get_site_option( 'admin_email' );
    271 
    272     if ( empty( $admin_email ) )
    273         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    274 
    275     $from_name       = bp_get_option( 'blogname', 'WordPress' );
    276     $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
    277     $message         = sprintf( __( "Thanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%1\$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%2\$s", 'buddypress' ), $activate_url, esc_url( "http://{$domain}{$path}" ) );
    278     $subject         = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
    279 
    280     // Send the message
    281     $to              = apply_filters( 'bp_core_activation_signup_blog_notification_to',   $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
    282     $subject         = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
    283     $message         = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    284 
    285     wp_mail( $to, $subject, $message, $message_headers );
     270    // Email contents
     271    $message = sprintf( __( "Thanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%1\$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%2\$s", 'buddypress' ), $activate_url, esc_url( "http://{$domain}{$path}" ) );
     272    $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
     273
     274    // Email filters
     275    $to      = apply_filters( 'bp_core_activation_signup_blog_notification_to',   $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
     276    $subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
     277    $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
     278
     279    // Send the email
     280    wp_mail( $to, $subject, $message );
    286281
    287282    do_action( 'bp_core_sent_blog_signup_email', $admin_email, $subject, $message, $domain, $path, $title, $user, $user_email, $key, $meta );
     
    305300function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    306301
     302    // Set up activation link
    307303    $activate_url = bp_get_activation_page() . "?key=$key";
    308     $activate_url = esc_url($activate_url);
    309     $admin_email  = get_site_option( 'admin_email' );
    310 
    311     if ( empty( $admin_email ) )
    312         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    313 
    314     $from_name       = bp_get_option( 'blogname', 'WordPress' );
    315     $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
    316     $message         = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url );
    317     $subject         = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    318 
    319     // Send the message
     304    $activate_url = esc_url( $activate_url );
     305
     306    // Email contents
     307    $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url );
     308    $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
     309
     310    // Email filters
    320311    $to      = apply_filters( 'bp_core_activation_signup_user_notification_to',   $user_email, $user, $user_email, $key, $meta );
    321312    $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta );
    322313    $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );
    323314
    324     wp_mail( $to, $subject, $message, $message_headers );
     315    // Send the email
     316    wp_mail( $to, $subject, $message );
    325317
    326318    do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta );
Note: See TracChangeset for help on using the changeset viewer.