<!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][3760] trunk/bp-messages: Some messages code clean-up</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>3760</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2011-01-20 11:43:41 +0000 (Thu, 20 Jan 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Some messages code clean-up</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpmessagesbpmessagesclassesphp">trunk/bp-messages/bp-messages-classes.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesfunctionsphp">trunk/bp-messages/bp-messages-functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpmessagesbpmessagesclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-classes.php (3759 => 3760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-classes.php        2011-01-20 11:30:23 UTC (rev 3759)
+++ trunk/bp-messages/bp-messages-classes.php        2011-01-20 11:43:41 UTC (rev 3760)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">                         $order= 'ASC';
</span><span class="cx">
</span><span class="cx">                 $this->messages_order = $order;
</span><del>-                $this->thread_id = $thread_id;
</del><ins>+                $this->thread_id = $thread_id;
</ins><span class="cx">
</span><span class="cx">                 if ( !$this->messages = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE thread_id = %d ORDER BY date_sent " . $order, $this->thread_id ) ) )
</span><span class="cx">                         return false;
</span><span class="lines">@@ -28,10 +28,10 @@
</span><span class="cx">                 foreach ( (array)$this->messages as $key => $message )
</span><span class="cx">                         $this->sender_ids[$message->sender_id] = $message->sender_id;
</span><span class="cx">
</span><del>-                /* Fetch the recipients */
</del><ins>+                // Fetch the recipients
</ins><span class="cx">                 $this->recipients = $this->get_recipients();
</span><span class="cx">
</span><del>-                /* Get the unread count for the logged in user */
</del><ins>+                // Get the unread count for the logged in user
</ins><span class="cx">                 if ( isset( $this->recipients[$bp->loggedin_user->id] ) )
</span><span class="cx">                         $this->unread_count = $this->recipients[$bp->loggedin_user->id]->unread_count;
</span><span class="cx">         }
</span><span class="lines">@@ -67,10 +67,10 @@
</span><span class="cx">                 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
</span><span class="cx">
</span><span class="cx">                 if ( empty( $recipients ) ) {
</span><del>-                        /* Delete all the messages */
</del><ins>+                        // Delete all the messages
</ins><span class="cx">                         $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );
</span><span class="cx">
</span><del>-                        /* Delete all the recipients */
</del><ins>+                        // Delete all the recipients
</ins><span class="cx">                         $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -80,11 +80,10 @@
</span><span class="cx">         function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                $pag_sql = '';
</del><ins>+                $pag_sql = $type_sql = '';
</ins><span class="cx">                 if ( $limit && $page )
</span><span class="cx">                         $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
</span><span class="cx">
</span><del>-                $type_sql = '';
</del><span class="cx">                 if ( $type == 'unread' )
</span><span class="cx">                         $type_sql = $wpdb->prepare( " AND r.unread_count != 0 " );
</span><span class="cx">                 elseif ( $type == 'read' )
</span><span class="lines">@@ -101,12 +100,12 @@
</span><span class="cx">                 if ( empty( $thread_ids ) )
</span><span class="cx">                         return false;
</span><span class="cx">
</span><del>-                /* Sort threads by date_sent */
-                foreach( (array)$thread_ids as $thread ) {
-                        $sorted_threads[$thread->thread_id] = strtotime($thread->date_sent);
-                }
-                arsort($sorted_threads);
</del><ins>+                // Sort threads by date_sent
+                foreach( (array)$thread_ids as $thread )
+                        $sorted_threads[$thread->thread_id] = strtotime( $thread->date_sent );
</ins><span class="cx">
</span><ins>+                arsort( $sorted_threads );
+
</ins><span class="cx">                 $threads = false;
</span><span class="cx">                 foreach ( (array)$sorted_threads as $thread_id => $date_sent )
</span><span class="cx">                         $threads[] = new BP_Messages_Thread( $thread_id );
</span><span class="lines">@@ -172,17 +171,17 @@
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 $count = 0;
</span><del>-                for ( $i = 0; $i < count($unread_counts); $i++ ) {
</del><ins>+                for ( $i = 0; $i < count( $unread_counts ); $i++ ) {
</ins><span class="cx">                         $count += $unread_counts[$i]->unread_count;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 return $count;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function check_access( $thread_id, $user_id = false ) {
</del><ins>+        function check_access( $thread_id, $user_id = 0 ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><del>-                if ( !$user_id )
</del><ins>+                if ( empty( $user_id ) )
</ins><span class="cx">                         $user_id = $bp->loggedin_user->id;
</span><span class="cx">
</span><span class="cx">                 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $thread_id, $user_id ) );
</span><span class="lines">@@ -198,14 +197,13 @@
</span><span class="cx">                 if ( count($recipients) >= 5 )
</span><span class="cx">                         return count( $recipients ) . __(' Recipients', 'buddypress');
</span><span class="cx">
</span><del>-                foreach ( (array)$recipients as $recipient ) {
</del><ins>+                foreach ( (array)$recipients as $recipient )
</ins><span class="cx">                         $recipient_links[] = bp_core_get_userlink( $recipient->user_id );
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 return implode( ', ', (array) $recipient_links );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        /* Update Functions */
</del><ins>+        // Update Functions
</ins><span class="cx">
</span><span class="cx">         function update_tables() {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="lines">@@ -213,7 +211,7 @@
</span><span class="cx">                 $errors = false;
</span><span class="cx">                 $threads = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}bp_messages_threads" ) );
</span><span class="cx">
</span><del>-                /* Nothing to update, just return true to remove the table */
</del><ins>+                // Nothing to update, just return true to remove the table
</ins><span class="cx">                 if ( empty( $threads ) )
</span><span class="cx">                         return true;
</span><span class="cx">
</span><span class="lines">@@ -223,7 +221,7 @@
</span><span class="cx">                         if ( !empty( $message_ids ) ) {
</span><span class="cx">                                 $message_ids = implode( ',', $message_ids );
</span><span class="cx">
</span><del>-                                /* Add the thread_id to the messages table */
</del><ins>+                                // Add the thread_id to the messages table
</ins><span class="cx">                                 if ( !$wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_messages} SET thread_id = %d WHERE id IN ({$message_ids})", $thread->id ) ) )
</span><span class="cx">                                         $errors = true;
</span><span class="cx">                         }
</span><span class="lines">@@ -252,20 +250,19 @@
</span><span class="cx">                 $this->date_sent = bp_core_current_time();
</span><span class="cx">                 $this->sender_id = $bp->loggedin_user->id;
</span><span class="cx">
</span><del>-                if ( $id ) {
-                        $this->populate($id);
-                }
</del><ins>+                if ( !empty( $id ) )
+                        $this->populate( $id );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function populate( $id ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 if ( $message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id ) ) ) {
</span><del>-                        $this->id = $message->id;
</del><ins>+                        $this->id = $message->id;
</ins><span class="cx">                         $this->thread_id = $message->thread_id;
</span><span class="cx">                         $this->sender_id = $message->sender_id;
</span><del>-                        $this->subject = $message->subject;
-                        $this->message = $message->message;
</del><ins>+                        $this->subject = $message->subject;
+                        $this->message = $message->message;
</ins><span class="cx">                         $this->date_sent = $message->date_sent;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -275,19 +272,19 @@
</span><span class="cx">
</span><span class="cx">                 $this->sender_id = apply_filters( 'messages_message_sender_id_before_save', $this->sender_id, $this->id );
</span><span class="cx">                 $this->thread_id = apply_filters( 'messages_message_thread_id_before_save', $this->thread_id, $this->id );
</span><del>-                $this->subject = apply_filters( 'messages_message_subject_before_save', $this->subject, $this->id );
-                $this->message = apply_filters( 'messages_message_content_before_save', $this->message, $this->id );
</del><ins>+                $this->subject = apply_filters( 'messages_message_subject_before_save', $this->subject, $this->id );
+                $this->message = apply_filters( 'messages_message_content_before_save', $this->message, $this->id );
</ins><span class="cx">                 $this->date_sent = apply_filters( 'messages_message_date_sent_before_save', $this->date_sent, $this->id );
</span><span class="cx">
</span><span class="cx">                 do_action( 'messages_message_before_save', $this );
</span><span class="cx">
</span><del>-                /* Make sure we have at least one recipient before sending. */
</del><ins>+                // Make sure we have at least one recipient before sending.
</ins><span class="cx">                 if ( empty( $this->recipients ) )
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 $new_thread = false;
</span><span class="cx">
</span><del>-                /* If we have no thread_id then this is the first message of a new thread. */
</del><ins>+                // If we have no thread_id then this is the first message of a new thread.
</ins><span class="cx">                 if ( empty( $this->thread_id ) ) {
</span><span class="cx">                         $this->thread_id = (int)$wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1;
</span><span class="cx">                         $new_thread = true;
</span><span class="lines">@@ -298,15 +295,15 @@
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 if ( $new_thread ) {
</span><del>-                        /* Add an recipient entry for all recipients */
</del><ins>+                        // Add an recipient entry for all recipients
</ins><span class="cx">                         foreach ( (array)$this->recipients as $recipient )
</span><span class="cx">                                 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient->user_id, $this->thread_id ) );
</span><span class="cx">
</span><del>-                        /* Add a sender recipient entry if the sender is not in the list of recipients */
</del><ins>+                        // Add a sender recipient entry if the sender is not in the list of recipients
</ins><span class="cx">                         if ( !in_array( $this->sender_id, $this->recipients ) )
</span><span class="cx">                                 $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, sender_only ) VALUES ( %d, %d, 1 )", $this->sender_id, $this->thread_id ) );
</span><span class="cx">                 } else {
</span><del>-                        /* Update the unread count for all recipients */
</del><ins>+                        // Update the unread count for all recipients
</ins><span class="cx">                         $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = unread_count + 1, sender_only = 0, is_deleted = 0 WHERE thread_id = %d AND user_id != %d", $this->thread_id, $this->sender_id ) );
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -364,7 +361,7 @@
</span><span class="cx">         var $date_sent;
</span><span class="cx">         var $is_active;
</span><span class="cx">
</span><del>-        function bp_messages_notice($id = null) {
</del><ins>+        function bp_messages_notice( $id = null ) {
</ins><span class="cx">                 if ( $id ) {
</span><span class="cx">                         $this->id = $id;
</span><span class="cx">                         $this->populate($id);
</span><span class="lines">@@ -377,8 +374,8 @@
</span><span class="cx">                 $notice = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id ) );
</span><span class="cx">
</span><span class="cx">                 if ( $notice ) {
</span><del>-                        $this->subject = $notice->subject;
-                        $this->message = $notice->message;
</del><ins>+                        $this->subject = $notice->subject;
+                        $this->message = $notice->message;
</ins><span class="cx">                         $this->date_sent = $notice->date_sent;
</span><span class="cx">                         $this->is_active = $notice->is_active;
</span><span class="cx">                 }
</span><span class="lines">@@ -392,13 +389,12 @@
</span><span class="cx">
</span><span class="cx">                 do_action( 'messages_notice_before_save', $this );
</span><span class="cx">
</span><del>-                if ( !$this->id ) {
</del><ins>+                if ( empty( $this->id ) )
</ins><span class="cx">                         $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );
</span><del>-                }
</del><span class="cx">
</span><del>-                if ( !$wpdb->query($sql) )
</del><ins>+                if ( !$wpdb->query( $sql ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 if ( !$id = $this->id )
</span><span class="lines">@@ -435,7 +431,7 @@
</span><span class="cx">
</span><span class="cx">                 $sql = $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_notices} WHERE id = %d", $this->id );
</span><span class="cx">
</span><del>-                if ( !$wpdb->query($sql) )
</del><ins>+                if ( !$wpdb->query( $sql ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 return true;
</span><span class="lines">@@ -462,7 +458,7 @@
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx">                 $notice_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_notices} WHERE is_active = 1") );
</span><del>-                return new BP_Messages_Notice($notice_id);
</del><ins>+                return new BP_Messages_Notice( $notice_id );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-functions.php (3759 => 3760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-functions.php        2011-01-20 11:30:23 UTC (rev 3759)
+++ trunk/bp-messages/bp-messages-functions.php        2011-01-20 11:43:41 UTC (rev 3760)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx">
</span><del>-        if ( !$sender_id || !$content )
</del><ins>+        if ( empty( $sender_id ) || empty( $content ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         // Create a new message object
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">         $message->date_sent = $date_sent;
</span><span class="cx">
</span><span class="cx">         // If we have a thread ID, use the existing recipients, otherwise use the recipients passed
</span><del>-        if ( $thread_id ) {
</del><ins>+        if ( !empty( $thread_id ) ) {
</ins><span class="cx">                 $thread = new BP_Messages_Thread( $thread_id );
</span><span class="cx">                 $message->recipients = $thread->get_recipients();
</span><span class="cx">
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">
</span><span class="cx">                 // Format this to match existing recipients
</span><span class="cx">                 foreach( (array)$recipient_ids as $i => $recipient_id ) {
</span><del>-                        $message->recipients[$i] = new stdClass;
</del><ins>+                        $message->recipients[$i] = new stdClass;
</ins><span class="cx">                         $message->recipients[$i]->user_id = $recipient_id;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">                                 $error = 1;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( $error )
</del><ins>+                if ( !empty( $error ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 do_action( 'messages_delete_thread', $thread_ids );
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx"> function messages_check_thread_access( $thread_id, $user_id = 0 ) {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( !$user_id )
</del><ins>+        if ( empty( $user_id ) )
</ins><span class="cx">                 $user_id = $bp->loggedin_user->id;
</span><span class="cx">
</span><span class="cx">         return BP_Messages_Thread::check_access( $thread_id, $user_id );
</span><span class="lines">@@ -160,21 +160,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function messages_add_callback_values( $recipients, $subject, $content ) {
</span><del>-        setcookie( 'bp_messages_send_to', $recipients, time()+60*60*24, COOKIEPATH );
-        setcookie( 'bp_messages_subject', $subject, time()+60*60*24, COOKIEPATH );
-        setcookie( 'bp_messages_content', $content, time()+60*60*24, COOKIEPATH );
</del><ins>+        @setcookie( 'bp_messages_send_to', $recipients, time() + 60 * 60 * 24, COOKIEPATH );
+        @setcookie( 'bp_messages_subject', $subject, time() + 60 * 60 * 24, COOKIEPATH );
+        @setcookie( 'bp_messages_content', $content, time() + 60 * 60 * 24, COOKIEPATH );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function messages_remove_callback_values() {
</span><del>-        setcookie( 'bp_messages_send_to', false, time()-1000, COOKIEPATH );
-        setcookie( 'bp_messages_subject', false, time()-1000, COOKIEPATH );
-        setcookie( 'bp_messages_content', false, time()-1000, COOKIEPATH );
</del><ins>+        @setcookie( 'bp_messages_send_to', false, time() - 1000, COOKIEPATH );
+        @setcookie( 'bp_messages_subject', false, time() - 1000, COOKIEPATH );
+        @setcookie( 'bp_messages_content', false, time() - 1000, COOKIEPATH );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function messages_get_unread_count( $user_id = 0 ) {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( !$user_id )
</del><ins>+        if ( empty( $user_id ) )
</ins><span class="cx">                 $user_id = $bp->loggedin_user->id;
</span><span class="cx">
</span><span class="cx">         return BP_Messages_Thread::get_inbox_count( $user_id );
</span></span></pre>
</div>
</div>
</body>
</html>