<!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][13584] trunk/src: BP Legacy: improve private messages user feedback management</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 { white-space: pre-line; 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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/13584">13584</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/13584","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-20 01:00:54 +0000 (Wed, 20 Sep 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>BP Legacy: improve private messages user feedback management

- Use a redirect to be sure to clear template notices when a required field is missing at next page load.
- Preserve submitted texts and contacts in case of missing required fields (using cookies, see `messages_add_callback_values()`).
- Improve the template so that it directly informs about **all** missing required fields at once.

Props niftythree, amitgrhr

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8578">#8578</a>
Closes https://github.com/buddypress/buddypress/pull/167</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmessagesactionscomposephp">trunk/src/bp-messages/actions/compose.php</a></li>
<li><a href="#trunksrcbpmessagesbpmessagestemplatephp">trunk/src/bp-messages/bp-messages-template.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssinglemessagescomposephp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/compose.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmessagesactionscomposephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/actions/compose.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/actions/compose.php 2023-09-18 02:20:59 UTC (rev 13583)
+++ trunk/src/bp-messages/actions/compose.php   2023-09-20 01:00:54 UTC (rev 13584)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,47 +28,96 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $redirect_to = '';
</span><span class="cx" style="display: block; padding: 0 10px">        $feedback    = '';
</span><span class="cx" style="display: block; padding: 0 10px">        $success     = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $is_notice   = isset( $_POST['send-notice'] );
+       $path_chunks = array( bp_get_messages_slug() );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Missing subject or content.
-       if ( empty( $_POST['subject'] ) || empty( $_POST['content'] ) ) {
-               $success  = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // List required vars and error messages.
+       $required_vars = array(
+               'subject' => __( 'Please enter a subject line.', 'buddypress' ),
+               'content' => __( 'Please enter some content.', 'buddypress' ),
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( empty( $_POST['subject'] ) ) {
-                       $feedback = __( 'Your message was not sent. Please enter a subject line.', 'buddypress' );
-               } else {
-                       $feedback = __( 'Your message was not sent. Please enter some content.', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The username is only needed for private messages.
+       if ( ! $is_notice ) {
+               $required_vars = array_merge(
+                       array(
+                               'send_to_usernames' => __( 'Please enter a username or Friend\'s name.', 'buddypress' ),
+                       ),
+                       $required_vars
+               );
+       }
+
+       // Calculate whether some required vars are missing.
+       $needed_keys    = array_intersect_key( $_POST, $required_vars );
+       $needs_feedback = count( array_filter( $needed_keys ) ) !== count( $required_vars );
+
+       // Prevent notice errors.
+       $required_args = array_map(
+               'wp_unslash',
+               bp_parse_args(
+                       $needed_keys,
+                       array(
+                               'send_to_usernames' => '',
+                               'subject'           => '',
+                               'content'           => ''
+                       )
+               )
+       );
+
+       // Use cookies to preserve existing values.
+       messages_add_callback_values(
+               implode( ' ', wp_parse_list( $required_args['send_to_usernames'] ) ),
+               esc_html( $required_args['subject'] ),
+               esc_textarea( $required_args['content'] )
+       );
+
+       // Handle required vars.
+       if ( $needs_feedback ) {
+               $success       = false;
+               $path_chunks[] = 'compose';
+               $feedbacks     = array( __( 'Your message was not sent.', 'buddypress' ) );
+
+               foreach ( $required_vars as $required_key => $required_var_feedback ) {
+                       if ( ! $required_args[ $required_key ] ) {
+                               $feedbacks[] = $required_var_feedback;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Subject and content present.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Set the feedback message.
+               $feedback    = implode( "\n", $feedbacks );
+               $redirect_to = bp_loggedin_user_url( bp_members_get_path_chunks( $path_chunks ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         } else {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Setup the link to the logged-in user's messages.
-               $path_chunks = array( bp_get_messages_slug() );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 // Site-wide notice.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( isset( $_POST['send-notice'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $is_notice ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Attempt to save the notice and redirect to notices.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( messages_send_notice( $required_args['subject'], $required_args['content'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $success       = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                $feedback      = __( 'Notice successfully created.', 'buddypress' );
</span><span class="cx" style="display: block; padding: 0 10px">                                $path_chunks[] = 'notices';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $redirect_to   = bp_loggedin_user_url( bp_members_get_path_chunks( $path_chunks ) );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Notice could not be sent.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         // Notice could not be sent.
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $success  = false;
-                               $feedback = __( 'Notice was not created. Please try again.', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $success       = false;
+                               $path_chunks[] = 'compose';
+                               $feedback      = __( 'Notice was not created. Please try again.', 'buddypress' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Private conversation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $redirect_to = bp_loggedin_user_url( bp_members_get_path_chunks( $path_chunks ) );
+
+                       // Private conversation.
</ins><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Filter recipients into the format we need - array( 'username/userid', 'username/userid' ).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $autocomplete_recipients = (array) explode( ',', $_POST['send-to-input'] );
-                       $typed_recipients        = (array) explode( ' ', $_POST['send_to_usernames'] );
-                       $recipients              = array_merge( $autocomplete_recipients, $typed_recipients );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $autocomplete_recipients = array();
+                       if ( isset( $_POST['send-to-input'] ) && $_POST['send-to-input'] ) {
+                               $autocomplete_recipients = (array) explode( ',', $_POST['send-to-input'] );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $typed_recipients = (array) explode( ' ', $required_args['send_to_usernames'] );
+                       $recipients       = array_merge( $autocomplete_recipients, $typed_recipients );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         /**
</span><span class="cx" style="display: block; padding: 0 10px">                         * Filters the array of recipients to receive the composed message.
</span><span class="cx" style="display: block; padding: 0 10px">                         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,12 +128,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $recipients = apply_filters( 'bp_messages_recipients', $recipients );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Attempt to send the message.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $send = messages_new_message( array(
-                               'recipients' => $recipients,
-                               'subject'    => $_POST['subject'],
-                               'content'    => $_POST['content'],
-                               'error_type' => 'wp_error',
-                       ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $send = messages_new_message(
+                               array(
+                                       'recipients' => $recipients,
+                                       'subject'    => $required_args['subject'],
+                                       'content'    => $required_args['content'],
+                                       'error_type' => 'wp_error',
+                               )
+                       );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Send the message and redirect to it.
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( true === is_int( $send ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,13 +143,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $feedback      = __( 'Message successfully sent.', 'buddypress' );
</span><span class="cx" style="display: block; padding: 0 10px">                                $path_chunks[] = 'view';
</span><span class="cx" style="display: block; padding: 0 10px">                                $path_chunks[] = array( $send );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $redirect_to   = bp_loggedin_user_url( bp_members_get_path_chunks( $path_chunks ) );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Message could not be sent.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         // Message could not be sent.
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $success  = false;
-                               $feedback = $send->get_error_message();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $success       = false;
+                               $path_chunks[] = 'compose';
+                               $feedback      = $send->get_error_message();
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       $redirect_to = bp_loggedin_user_url( bp_members_get_path_chunks( $path_chunks ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbpmessagesbpmessagestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/bp-messages-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/bp-messages-template.php    2023-09-18 02:20:59 UTC (rev 13583)
+++ trunk/src/bp-messages/bp-messages-template.php      2023-09-20 01:00:54 UTC (rev 13584)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1003,9 +1003,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_messages_subject_value() {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Sanitized in bp-messages-filters.php.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $subject = ! empty( $_POST['subject'] )
-                       ? $_POST['subject']
-                       : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $subject = '';
+               if ( isset( $_POST['subject'] ) && $_POST['subject'] ) {
+                       $subject = $_POST['subject'];
+               } elseif ( isset( $_COOKIE['bp_messages_subject'] ) && $_COOKIE['bp_messages_subject'] ) {
+                       $subject = $_COOKIE['bp_messages_subject'];
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the default value for the subject field.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1034,9 +1037,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_messages_content_value() {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Sanitized in bp-messages-filters.php.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content = ! empty( $_POST['content'] )
-                       ? $_POST['content']
-                       : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $content = '';
+               if ( isset( $_POST['content'] ) && $_POST['content'] ) {
+                       $content = $_POST['content'];
+               } elseif ( isset( $_COOKIE['bp_messages_content'] ) && $_COOKIE['bp_messages_content'] ) {
+                       $content = $_COOKIE['bp_messages_content'];
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the default value for the content field.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1679,9 +1685,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_message_get_recipient_usernames() {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Sanitized in bp-messages-filters.php.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $recipients = isset( $_GET['r'] )
-                       ? $_GET['r']
-                       : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $recipients = '';
+               if ( isset( $_GET['r'] ) && $_GET['r'] ) {
+                       $recipients = $_GET['r'];
+               } elseif ( isset( $_COOKIE['bp_messages_send_to'] ) && $_COOKIE['bp_messages_send_to'] ) {
+                       $recipients = $_COOKIE['bp_messages_send_to'];
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the recipients usernames for prefilling the 'To' field on the Compose screen.
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssinglemessagescomposephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/compose.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/compose.php   2023-09-18 02:20:59 UTC (rev 13583)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/compose.php     2023-09-20 01:00:54 UTC (rev 13584)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <h2 class="bp-screen-reader-text"><?php
</span><span class="cx" style="display: block; padding: 0 10px">        /* translators: accessibility text */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        _e( 'Compose Message', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ esc_html_e( 'Compose Message', 'buddypress' );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?></h2>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <form action="<?php bp_messages_form_action(); ?>" method="post" id="send_message_form" class="standard-form" enctype="multipart/form-data">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +24,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        do_action( 'bp_before_messages_compose_content' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <label for="send-to-input"><?php _e("Send To (Username or Friend's Name)", 'buddypress' ); ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="send-to-input"><?php esc_html_e( 'Send To (Username or Friend\'s Name)', 'buddypress' ); ?></label>
</ins><span class="cx" style="display: block; padding: 0 10px">         <ul class="first acfb-holder">
</span><span class="cx" style="display: block; padding: 0 10px">                <li>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php bp_message_get_recipient_tabs(); ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,13 +33,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <?php if ( bp_current_user_can( 'bp_moderate' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                <p><label for="send-notice"><input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", 'buddypress' ); ?></label></p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         <p><label for="send-notice"><input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php esc_html_e( "This is a notice to all users.", 'buddypress' ); ?></label></p>
</ins><span class="cx" style="display: block; padding: 0 10px">         <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <label for="subject"><?php _e( 'Subject', 'buddypress' ); ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="subject"><?php esc_html_e( 'Subject', 'buddypress' ); ?></label>
</ins><span class="cx" style="display: block; padding: 0 10px">         <input type="text" name="subject" id="subject" value="<?php bp_messages_subject_value(); ?>" />
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <label for="message_content"><?php _e( 'Message', 'buddypress' ); ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label for="message_content"><?php esc_html_e( 'Message', 'buddypress' ); ?></label>
</ins><span class="cx" style="display: block; padding: 0 10px">         <textarea name="content" id="message_content" rows="15" cols="40"><?php bp_messages_content_value(); ?></textarea>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <input type="hidden" name="send_to_usernames" id="send-to-usernames" value="<?php bp_message_get_recipient_usernames(); ?>" class="<?php bp_message_get_recipient_usernames(); ?>" />
</span></span></pre>
</div>
</div>

</body>
</html>