<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][6589] trunk: Revert r6587:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/6589">6589</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2012-12-10 09:55:56 +0000 (Mon, 10 Dec 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Revert r6587:
* Introduce bp_get_email_subject() function, to handle formatting of email subjects.
* For all components with notifications, including deprecated files.
* Fixes <a href="http://buddypress.trac.wordpress.org/ticket/4401">#4401</a>, better this time.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivitynotificationsphp">trunk/bp-activity/bp-activity-notifications.php</a></li>
<li><a href="#trunkbpcorebpcorefiltersphp">trunk/bp-core/bp-core-filters.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatephp">trunk/bp-core/bp-core-template.php</a></li>
<li><a href="#trunkbpcoredeprecated15php">trunk/bp-core/deprecated/1.5.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsnotificationsphp">trunk/bp-friends/bp-friends-notifications.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsnotificationsphp">trunk/bp-groups/bp-groups-notifications.php</a></li>
<li><a href="#trunkbpmembersbpmembersfunctionsphp">trunk/bp-members/bp-members-functions.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesnotificationsphp">trunk/bp-messages/bp-messages-notifications.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivitynotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-notifications.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-notifications.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-activity/bp-activity-notifications.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -70,8 +70,7 @@
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $ud = bp_core_get_core_userdata( $receiver_user_id );
</span><span class="cx">                 $to = $ud->user_email;
</span><del>-                $sitename = bp_get_option( 'blogname', 'WordPress' );
-                $subject = '[' . $sitename . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
</del><ins>+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name ) ) );
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_active( 'groups' ) && bp_is_group() ) {
</span><span class="cx">                         $message = sprintf( __(
</span><span class="lines">@@ -157,12 +156,10 @@
</span><span class="cx">                 $content = bp_activity_filter_kses( stripslashes($content) );
</span><span class="cx">
</span><span class="cx">                 // Set up and send the message
</span><del>-                $ud = bp_core_get_core_userdata( $original_activity->user_id );
-                $to = $ud->user_email;
-                $sitename = bp_get_option( 'blogname', 'WordPress' );
-                $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
-
-$message = sprintf( __(
</del><ins>+                $ud = bp_core_get_core_userdata( $original_activity->user_id );
+                $to = $ud->user_email;
+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name ) ) );
+                $message = sprintf( __(
</ins><span class="cx"> '%1$s replied to one of your updates:
</span><span class="cx">
</span><span class="cx"> "%2$s"
</span><span class="lines">@@ -202,8 +199,7 @@
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $ud = bp_core_get_core_userdata( $parent_comment->user_id );
</span><span class="cx">                 $to = $ud->user_email;
</span><del>-                $sitename = bp_get_option( 'blogname', 'WordPress' );
-                $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
</del><ins>+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name ) ) );
</ins><span class="cx">
</span><span class="cx">                 $poster_name = stripslashes( $poster_name );
</span><span class="cx">                 $content = bp_activity_filter_kses( stripslashes( $content ) );
</span></span></pre></div>
<a id="trunkbpcorebpcorefiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-filters.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-filters.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-core/bp-core-filters.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">         $from_name = bp_get_option( 'blogname', 'WordPress' );
</span><span class="cx">         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
</span><span class="cx">         $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}" ) );
</span><del>-        $subject = '[' . $from_name . '] ' . sprintf(__( 'Activate %s', 'buddypress' ), esc_url( 'http://' . $domain . $path ) );
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
</ins><span class="cx">
</span><span class="cx">         // Send the message
</span><span class="cx">         $to = apply_filters( 'bp_core_activation_signup_blog_notification_to', $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
</span><span class="lines">@@ -283,7 +283,7 @@
</span><span class="cx">         $from_name = bp_get_option( 'blogname', 'WordPress' );
</span><span class="cx">         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
</span><span class="cx">         $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 );
</span><del>-        $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
</ins><span class="cx">
</span><span class="cx">         // Send the message
</span><span class="cx">         $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta );
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-template.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-template.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-core/bp-core-template.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -539,6 +539,31 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Retrieve a client friendly version of the root blog name, plus take care of
+ * the typical formatting bits and bobs.
+ *
+ * The blogname option is escaped with esc_html on the way into the database in
+ * sanitize_option, we want to reverse this for the plain text arena of emails.
+ *
+ * @link http://buddypress.trac.wordpress.org/ticket/4401
+ * @since BuddyPress (1.7)
+ * @return string
+ */
+function bp_get_email_subject( $args = array() ) {
+
+        $r = wp_parse_args( $args, array(
+                'before' => '[',
+                'after' => ']',
+                'default' => __( 'Community', 'buddypress' ),
+                'text' => ''
+        ) );
+
+        $subject = $r['before'] . wp_specialchars_decode( bp_get_option( 'blogname', $default ), ENT_QUOTES ) . $r['after'] . ' ' . $r['text'];
+
+        return apply_filters( 'bp_get_email_subject', $subject, $r );
+}
+
+/**
</ins><span class="cx"> * Allow templates to pass parameters directly into the template loops via AJAX
</span><span class="cx"> *
</span><span class="cx"> * For the most part this will be filtered in a theme's functions.php for example
</span></span></pre></div>
<a id="trunkbpcoredeprecated15php"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/deprecated/1.5.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/deprecated/1.5.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-core/deprecated/1.5.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -349,8 +349,7 @@
</span><span class="cx">                         // Set up and send the message
</span><span class="cx">                         $ud = bp_core_get_core_userdata( $receiver_user_id );
</span><span class="cx">                         $to = $ud->user_email;
</span><del>-                        $sitename = bp_get_option( 'blogname', 'WordPress' );
-                        $subject = '[' . $sitename . '] ' . sprintf( __( '%1$s mentioned you in the group "%2$s"', 'buddypress' ), $poster_name, $group->name );
</del><ins>+                        $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%1$s mentioned you in the group "%2$s"', 'buddypress' ), $poster_name, $group->name ) ) );
</ins><span class="cx">
</span><span class="cx"> $message = sprintf( __(
</span><span class="cx"> '%1$s mentioned you in the group "%2$s":
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-notifications.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-notifications.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-friends/bp-friends-notifications.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -28,10 +28,8 @@
</span><span class="cx">
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud->user_email;
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
-        $subject = '[' . $sitename . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
-
-        $message = sprintf( __(
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name ) ) );
+        $message = sprintf( __(
</ins><span class="cx"> '%1$s wants to add you as a friend.
</span><span class="cx">
</span><span class="cx"> To view all of your pending friendship requests: %2$s
</span><span class="lines">@@ -67,10 +65,8 @@
</span><span class="cx">
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud->user_email;
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
-        $subject = '[' . $sitename . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
-
-        $message = sprintf( __(
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name ) ) );
+        $message = sprintf( __(
</ins><span class="cx"> '%1$s accepted your friend request.
</span><span class="cx">
</span><span class="cx"> To view %2$s\'s profile: %3$s
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-notifications.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-notifications.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-groups/bp-groups-notifications.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -16,10 +16,9 @@
</span><span class="cx"> function groups_notification_group_updated( $group_id ) {
</span><span class="cx">
</span><span class="cx">         $group = groups_get_group( array( 'group_id' => $group_id ) );
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
-        $subject = '[' . $sitename . '] ' . __( 'Group Details Updated', 'buddypress' );
-
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => __( 'Group Details Updated', 'buddypress' ) ) );
</ins><span class="cx">         $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
</span><ins>+
</ins><span class="cx">         foreach ( (array) $user_ids as $user_id ) {
</span><span class="cx">                 if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
</span><span class="cx">
</span><span class="lines">@@ -73,8 +72,7 @@
</span><span class="cx">
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud->user_email;
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
-        $subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name );
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
</ins><span class="cx">
</span><span class="cx"> $message = sprintf( __(
</span><span class="cx"> '%1$s wants to join the group "%2$s".
</span><span class="lines">@@ -122,10 +120,9 @@
</span><span class="cx">
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud->user_email;
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
</del><span class="cx">
</span><span class="cx">         if ( $accepted ) {
</span><del>-                $subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name );
</del><ins>+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name ) ) );
</ins><span class="cx">                 $message = sprintf( __(
</span><span class="cx"> 'Your membership request for the group "%1$s" has been accepted.
</span><span class="cx">
</span><span class="lines">@@ -135,7 +132,7 @@
</span><span class="cx"> ', 'buddypress' ), $group->name, $group_link );
</span><span class="cx">
</span><span class="cx">         } else {
</span><del>-                $subject = '[' . $sitename . '] ' . sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name );
</del><ins>+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name ) ) );
</ins><span class="cx">                 $message = sprintf( __(
</span><span class="cx"> 'Your membership request for the group "%1$s" has been rejected.
</span><span class="cx">
</span><span class="lines">@@ -181,10 +178,8 @@
</span><span class="cx">
</span><span class="cx">         // Set up and send the message
</span><span class="cx">         $to = $ud->user_email;
</span><del>-        $sitename = bp_get_option( 'blogname', 'WordPress' );
-        $subject = '[' . $sitename . '] ' . sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name );
-
-        $message = sprintf( __(
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name ) ) );
+        $message = sprintf( __(
</ins><span class="cx"> 'You have been promoted to %1$s for the group: "%2$s".
</span><span class="cx">
</span><span class="cx"> To view the group please visit: %3$s
</span><span class="lines">@@ -231,8 +226,7 @@
</span><span class="cx">
</span><span class="cx">                 // Set up and send the message
</span><span class="cx">                 $to = $invited_ud->user_email;
</span><del>-                $sitename = bp_get_option( 'blogname', 'WordPress' );
-                $subject = '[' . $sitename . '] ' . sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name );
</del><ins>+                $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name ) ) );
</ins><span class="cx">
</span><span class="cx">                 $message = sprintf( __(
</span><span class="cx"> 'One of your friends %1$s has invited you to the group: "%2$s".
</span></span></pre></div>
<a id="trunkbpmembersbpmembersfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-functions.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-functions.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-members/bp-members-functions.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -1339,10 +1339,8 @@
</span><span class="cx">         $activate_url = bp_get_activation_page() ."?key=$key";
</span><span class="cx">         $activate_url = esc_url( $activate_url );
</span><span class="cx">
</span><del>-        $from_name = bp_get_option( 'blogname', 'WordPress' );
-
</del><span class="cx">         $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 );
</span><del>-        $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
</del><ins>+        $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
</ins><span class="cx">
</span><span class="cx">         // Send the message
</span><span class="cx">         $to = apply_filters( 'bp_core_signup_send_validation_email_to', $user_email, $user_id );
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-notifications.php (6588 => 6589)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-notifications.php        2012-12-10 09:36:32 UTC (rev 6588)
+++ trunk/bp-messages/bp-messages-notifications.php        2012-12-10 09:55:56 UTC (rev 6589)
</span><span class="lines">@@ -47,8 +47,7 @@
</span><span class="cx">
</span><span class="cx">                         // Set up and send the message
</span><span class="cx">                         $email_to = $ud->user_email;
</span><del>-                        $sitename = bp_get_option( 'blogname', 'WordPress' );
-                        $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
</del><ins>+                        $email_subject = bp_get_email_subject( array( 'text' => sprintf( __( 'New message from %s', 'buddypress' ), $sender_name ) ) );
</ins><span class="cx">
</span><span class="cx">                         $email_content = sprintf( __(
</span><span class="cx"> '%1$s sent you a new message:
</span></span></pre>
</div>
</div>
</body>
</html>