Skip to:
Content

BuddyPress.org

Changeset 6589


Ignore:
Timestamp:
12/10/2012 09:55:56 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Revert r6587:

  • Introduce bp_get_email_subject() function, to handle formatting of email subjects.
  • For all components with notifications, including deprecated files.
  • Fixes #4401, better this time.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-notifications.php

    r6587 r6589  
    7171        $ud       = bp_core_get_core_userdata( $receiver_user_id );
    7272        $to       = $ud->user_email;
    73         $sitename = bp_get_option( 'blogname', 'WordPress' );
    74         $subject  = '[' . $sitename . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
     73        $subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name ) ) );
    7574
    7675        if ( bp_is_active( 'groups' ) && bp_is_group() ) {
     
    158157
    159158        // Set up and send the message
    160         $ud       = bp_core_get_core_userdata( $original_activity->user_id );
    161         $to       = $ud->user_email;
    162         $sitename = bp_get_option( 'blogname', 'WordPress' );
    163         $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
    164 
    165 $message = sprintf( __(
     159        $ud      = bp_core_get_core_userdata( $original_activity->user_id );
     160        $to      = $ud->user_email;
     161        $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name ) ) );
     162        $message = sprintf( __(
    166163'%1$s replied to one of your updates:
    167164
     
    203200        $ud       = bp_core_get_core_userdata( $parent_comment->user_id );
    204201        $to       = $ud->user_email;
    205         $sitename = bp_get_option( 'blogname', 'WordPress' );
    206         $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
     202        $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name ) ) );
    207203
    208204        $poster_name = stripslashes( $poster_name );
  • trunk/bp-core/bp-core-filters.php

    r6587 r6589  
    256256    $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
    257257    $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}" ) );
    258     $subject         = '[' . $from_name . '] ' . sprintf(__( 'Activate %s', 'buddypress' ), esc_url( 'http://' . $domain . $path ) );
     258    $subject         = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
    259259
    260260    // Send the message
     
    284284    $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
    285285    $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 );
    286     $subject         = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
     286    $subject         = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    287287
    288288    // Send the message
  • trunk/bp-core/bp-core-template.php

    r6512 r6589  
    540540
    541541/**
     542 * Retrieve a client friendly version of the root blog name, plus take care of
     543 * the typical formatting bits and bobs.
     544 *
     545 * The blogname option is escaped with esc_html on the way into the database in
     546 * sanitize_option, we want to reverse this for the plain text arena of emails.
     547 *
     548 * @link http://buddypress.trac.wordpress.org/ticket/4401
     549 * @since BuddyPress (1.7)
     550 * @return string
     551 */
     552function bp_get_email_subject( $args = array() ) {
     553
     554    $r = wp_parse_args( $args, array(
     555        'before'  => '[',
     556        'after'   => ']',
     557        'default' => __( 'Community', 'buddypress' ),
     558        'text'    => ''
     559    ) );
     560
     561    $subject = $r['before'] . wp_specialchars_decode( bp_get_option( 'blogname', $default ), ENT_QUOTES ) . $r['after'] . ' ' . $r['text'];
     562
     563    return apply_filters( 'bp_get_email_subject', $subject, $r );
     564}
     565
     566/**
    542567 * Allow templates to pass parameters directly into the template loops via AJAX
    543568 *
  • trunk/bp-core/deprecated/1.5.php

    r6587 r6589  
    350350            $ud = bp_core_get_core_userdata( $receiver_user_id );
    351351            $to = $ud->user_email;
    352             $sitename = bp_get_option( 'blogname', 'WordPress' );
    353             $subject  = '[' . $sitename . '] ' . sprintf( __( '%1$s mentioned you in the group "%2$s"', 'buddypress' ), $poster_name, $group->name );
     352            $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%1$s mentioned you in the group "%2$s"', 'buddypress' ), $poster_name, $group->name ) ) );
    354353
    355354$message = sprintf( __(
  • trunk/bp-friends/bp-friends-notifications.php

    r6587 r6589  
    2929    // Set up and send the message
    3030    $to       = $ud->user_email;
    31     $sitename = bp_get_option( 'blogname', 'WordPress' );
    32     $subject  = '[' . $sitename . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
    33 
    34     $message = sprintf( __(
     31    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name ) ) );
     32    $message  = sprintf( __(
    3533'%1$s wants to add you as a friend.
    3634
     
    6866    // Set up and send the message
    6967    $to       = $ud->user_email;
    70     $sitename = bp_get_option( 'blogname', 'WordPress' );
    71     $subject  = '[' . $sitename . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
    72 
    73     $message = sprintf( __(
     68    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name ) ) );
     69    $message  = sprintf( __(
    7470'%1$s accepted your friend request.
    7571
  • trunk/bp-groups/bp-groups-notifications.php

    r6587 r6589  
    1717
    1818    $group    = groups_get_group( array( 'group_id' => $group_id ) );
    19     $sitename = bp_get_option( 'blogname', 'WordPress' );
    20     $subject  = '[' . $sitename . '] ' . __( 'Group Details Updated', 'buddypress' );
    21 
     19    $subject  = bp_get_email_subject( array( 'text' => __( 'Group Details Updated', 'buddypress' ) ) );
    2220    $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
     21
    2322    foreach ( (array) $user_ids as $user_id ) {
    2423        if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
     
    7473    // Set up and send the message
    7574    $to       = $ud->user_email;
    76     $sitename = bp_get_option( 'blogname', 'WordPress' );
    77     $subject  = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name );
     75    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
    7876
    7977$message = sprintf( __(
     
    123121    // Set up and send the message
    124122    $to       = $ud->user_email;
    125     $sitename = bp_get_option( 'blogname', 'WordPress' );
    126123
    127124    if ( $accepted ) {
    128         $subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name );
     125        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name ) ) );
    129126        $message = sprintf( __(
    130127'Your membership request for the group "%1$s" has been accepted.
     
    136133
    137134    } else {
    138         $subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name );
     135        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name ) ) );
    139136        $message = sprintf( __(
    140137'Your membership request for the group "%1$s" has been rejected.
     
    182179    // Set up and send the message
    183180    $to       = $ud->user_email;
    184     $sitename = bp_get_option( 'blogname', 'WordPress' );
    185     $subject  = '[' . $sitename . '] ' . sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name );
    186 
    187     $message = sprintf( __(
     181    $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name ) ) );
     182    $message  = sprintf( __(
    188183'You have been promoted to %1$s for the group: "%2$s".
    189184
     
    232227        // Set up and send the message
    233228        $to       = $invited_ud->user_email;
    234         $sitename = bp_get_option( 'blogname', 'WordPress' );
    235         $subject  = '[' . $sitename . '] ' . sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name );
     229        $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name ) ) );
    236230
    237231        $message = sprintf( __(
  • trunk/bp-members/bp-members-functions.php

    r6587 r6589  
    13401340    $activate_url = esc_url( $activate_url );
    13411341
    1342     $from_name = bp_get_option( 'blogname', 'WordPress' );
    1343 
    13441342    $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 );
    1345     $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
     1343    $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    13461344
    13471345    // Send the message
  • trunk/bp-messages/bp-messages-notifications.php

    r6587 r6589  
    4848            // Set up and send the message
    4949            $email_to      = $ud->user_email;
    50             $sitename      = bp_get_option( 'blogname', 'WordPress' );
    51             $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
     50            $email_subject = bp_get_email_subject( array( 'text' => sprintf( __( 'New message from %s', 'buddypress' ), $sender_name ) ) );
    5251
    5352            $email_content = sprintf( __(
Note: See TracChangeset for help on using the changeset viewer.