From a606d15db1429418166ac83bb25c4656f75e3f3b Mon Sep 17 00:00:00 2001
From: Josh <josh@joshshashaty.com>
Date: Sun, 26 Oct 2014 19:56:30 -0400
Subject: [PATCH 1/3] recipients list in single message

---
 src/bp-messages/bp-messages-template.php           | 38 +++++++++++++++++-----
 .../buddypress/members/single/messages/single.php  | 12 +++++--
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/src/bp-messages/bp-messages-template.php b/src/bp-messages/bp-messages-template.php
index 90ed2f6..913a907 100644
--- a/src/bp-messages/bp-messages-template.php
+++ b/src/bp-messages/bp-messages-template.php
@@ -1498,25 +1498,47 @@ function bp_the_thread_subject() {
 	}
 
 /**
+ * Get the number of recipients in the current thread using number_format_i18n
+ * 
+ * @uses   bp_get_thread_recipients_count()
+ * 
+ * @return string
+ */
+function bp_get_the_thread_recipients(){
+	return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) );
+}
+
+/**
+ * Get the number of recipients in the current thread.
+ *
+ * @since BuddyPress 2.2
+ * 
+ * @return int
+ */
+function bp_get_thread_recipients_count() {
+	global $thread_template;
+	return count( $thread_template->thread->recipients );
+}
+
+/**
  * Output HTML links to recipients in the current thread.
+ *
+ * @uses bp_get_thread_recipients_list()
+ * @since BuddyPress 2.2
  */
-function bp_the_thread_recipients() {
-	echo bp_get_the_thread_recipients();
+function bp_the_thread_recipients_list() {
+	echo bp_get_thread_recipients_list();
 }
 	/**
 	 * Generate HTML links to the profiles of recipients in the current thread.
 	 *
 	 * @return string
 	 */
-	function bp_get_the_thread_recipients() {
+	function bp_get_thread_recipients_list() {
 		global $thread_template;
 
 		$recipient_links = array();
 
-		if ( count( $thread_template->thread->recipients ) >= 5 ) {
-			return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%d Recipients', 'buddypress' ), count( $thread_template->thread->recipients ) ) );
-		}
-
 		foreach( (array) $thread_template->thread->recipients as $recipient ) {
 			if ( (int) $recipient->user_id !== bp_loggedin_user_id() ) {
 				$recipient_link = bp_core_get_userlink( $recipient->user_id );
@@ -1529,7 +1551,7 @@ function bp_the_thread_recipients() {
 			}
 		}
 
-		return apply_filters( 'bp_get_the_thread_recipients', implode( ', ', $recipient_links ) );
+		return apply_filters( 'bp_get_the_thread_recipients_list', implode( ', ', $recipient_links ) );
 	}
 
 /**
diff --git a/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php b/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
index b501645..1948981 100644
--- a/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
+++ b/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
@@ -9,13 +9,21 @@
 		<p id="message-recipients">
 			<span class="highlight">
 
-				<?php if ( !bp_get_the_thread_recipients() ) : ?>
+				<?php if ( !bp_get_thread_recipients_count() ) : ?>
 
 					<?php _e( 'You are alone in this conversation.', 'buddypress' ); ?>
 
 				<?php else : ?>
 
-					<?php printf( __( 'Conversation between %s and you.', 'buddypress' ), bp_get_the_thread_recipients() ); ?>
+					<?php if ( 10 <= bp_get_thread_recipients_count() ) : ?>
+
+						<?php printf( __( 'Conversation between %s recipients.', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?>
+
+					<?php else : ?>
+
+						<?php printf( __( 'Conversation between %s and you.', 'buddypress' ), bp_get_thread_recipients_list() ); ?>
+
+					<?php endif; ?>					
 
 				<?php endif; ?>
 
-- 
1.8.1.msysgit.1


From f91fd070842b3fbde973fc12016c003c49081c06 Mon Sep 17 00:00:00 2001
From: Josh <josh@joshshashaty.com>
Date: Sun, 26 Oct 2014 20:12:22 -0400
Subject: [PATCH 2/3] old function returns same result

---
 src/bp-messages/bp-messages-template.php                           | 7 ++++++-
 .../bp-legacy/buddypress/members/single/messages/single.php        | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/bp-messages/bp-messages-template.php b/src/bp-messages/bp-messages-template.php
index 913a907..f7af593 100644
--- a/src/bp-messages/bp-messages-template.php
+++ b/src/bp-messages/bp-messages-template.php
@@ -1505,8 +1505,13 @@ function bp_the_thread_subject() {
  * @return string
  */
 function bp_get_the_thread_recipients(){
-	return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) );
+	if ( 5 <= bp_get_thread_recipients_count() ) {
+		return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) );
+	} else {
+		return bp_get_thread_recipients_list();
+	}
 }
+	
 
 /**
  * Get the number of recipients in the current thread.
diff --git a/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php b/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
index 1948981..18a06a6 100644
--- a/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
+++ b/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
@@ -15,7 +15,7 @@
 
 				<?php else : ?>
 
-					<?php if ( 10 <= bp_get_thread_recipients_count() ) : ?>
+					<?php if ( 5 <= bp_get_thread_recipients_count() ) : ?>
 
 						<?php printf( __( 'Conversation between %s recipients.', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?>
 
-- 
1.8.1.msysgit.1


From 86aba9d7baa110ee7693d7a3e96ff6eb8255b91b Mon Sep 17 00:00:00 2001
From: Josh <josh@joshshashaty.com>
Date: Sun, 26 Oct 2014 20:17:32 -0400
Subject: [PATCH 3/3] documentation change for original function

---
 src/bp-messages/bp-messages-template.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/bp-messages/bp-messages-template.php b/src/bp-messages/bp-messages-template.php
index f7af593..67e564a 100644
--- a/src/bp-messages/bp-messages-template.php
+++ b/src/bp-messages/bp-messages-template.php
@@ -1499,8 +1499,11 @@ function bp_the_thread_subject() {
 
 /**
  * Get the number of recipients in the current thread using number_format_i18n
+ * This function was originally used in user messages single.php and was split into the functions that follow it
+ * It's been modified to use the new functions and kept in case anyone is using in their theme
  * 
- * @uses   bp_get_thread_recipients_count()
+ * @uses bp_get_thread_recipients_count()
+ * @uses bp_get_thread_recipients_list
  * 
  * @return string
  */
-- 
1.8.1.msysgit.1

