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
|
b
|
function bp_the_thread_subject() {
|
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | /** |
| | 1501 | * Get the number of recipients in the current thread using number_format_i18n |
| | 1502 | * |
| | 1503 | * @uses bp_get_thread_recipients_count() |
| | 1504 | * |
| | 1505 | * @return string |
| | 1506 | */ |
| | 1507 | function bp_get_the_thread_recipients(){ |
| | 1508 | return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) ); |
| | 1509 | } |
| | 1510 | |
| | 1511 | /** |
| | 1512 | * Get the number of recipients in the current thread. |
| | 1513 | * |
| | 1514 | * @since BuddyPress 2.2 |
| | 1515 | * |
| | 1516 | * @return int |
| | 1517 | */ |
| | 1518 | function bp_get_thread_recipients_count() { |
| | 1519 | global $thread_template; |
| | 1520 | return count( $thread_template->thread->recipients ); |
| | 1521 | } |
| | 1522 | |
| | 1523 | /** |
| 1501 | 1524 | * Output HTML links to recipients in the current thread. |
| | 1525 | * |
| | 1526 | * @uses bp_get_thread_recipients_list() |
| | 1527 | * @since BuddyPress 2.2 |
| 1502 | 1528 | */ |
| 1503 | | function bp_the_thread_recipients() { |
| 1504 | | echo bp_get_the_thread_recipients(); |
| | 1529 | function bp_the_thread_recipients_list() { |
| | 1530 | echo bp_get_thread_recipients_list(); |
| 1505 | 1531 | } |
| 1506 | 1532 | /** |
| 1507 | 1533 | * Generate HTML links to the profiles of recipients in the current thread. |
| 1508 | 1534 | * |
| 1509 | 1535 | * @return string |
| 1510 | 1536 | */ |
| 1511 | | function bp_get_the_thread_recipients() { |
| | 1537 | function bp_get_thread_recipients_list() { |
| 1512 | 1538 | global $thread_template; |
| 1513 | 1539 | |
| 1514 | 1540 | $recipient_links = array(); |
| 1515 | 1541 | |
| 1516 | | if ( count( $thread_template->thread->recipients ) >= 5 ) { |
| 1517 | | return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%d Recipients', 'buddypress' ), count( $thread_template->thread->recipients ) ) ); |
| 1518 | | } |
| 1519 | | |
| 1520 | 1542 | foreach( (array) $thread_template->thread->recipients as $recipient ) { |
| 1521 | 1543 | if ( (int) $recipient->user_id !== bp_loggedin_user_id() ) { |
| 1522 | 1544 | $recipient_link = bp_core_get_userlink( $recipient->user_id ); |
| … |
… |
function bp_the_thread_recipients() {
|
| 1529 | 1551 | } |
| 1530 | 1552 | } |
| 1531 | 1553 | |
| 1532 | | return apply_filters( 'bp_get_the_thread_recipients', implode( ', ', $recipient_links ) ); |
| | 1554 | return apply_filters( 'bp_get_the_thread_recipients_list', implode( ', ', $recipient_links ) ); |
| 1533 | 1555 | } |
| 1534 | 1556 | |
| 1535 | 1557 | /** |
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
|
b
|
|
| 9 | 9 | <p id="message-recipients"> |
| 10 | 10 | <span class="highlight"> |
| 11 | 11 | |
| 12 | | <?php if ( !bp_get_the_thread_recipients() ) : ?> |
| | 12 | <?php if ( !bp_get_thread_recipients_count() ) : ?> |
| 13 | 13 | |
| 14 | 14 | <?php _e( 'You are alone in this conversation.', 'buddypress' ); ?> |
| 15 | 15 | |
| 16 | 16 | <?php else : ?> |
| 17 | 17 | |
| 18 | | <?php printf( __( 'Conversation between %s and you.', 'buddypress' ), bp_get_the_thread_recipients() ); ?> |
| | 18 | <?php if ( 10 <= bp_get_thread_recipients_count() ) : ?> |
| | 19 | |
| | 20 | <?php printf( __( 'Conversation between %s recipients.', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?> |
| | 21 | |
| | 22 | <?php else : ?> |
| | 23 | |
| | 24 | <?php printf( __( 'Conversation between %s and you.', 'buddypress' ), bp_get_thread_recipients_list() ); ?> |
| | 25 | |
| | 26 | <?php endif; ?> |
| 19 | 27 | |
| 20 | 28 | <?php endif; ?> |
| 21 | 29 | |
--
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
|
b
|
function bp_the_thread_subject() {
|
| 1505 | 1505 | * @return string |
| 1506 | 1506 | */ |
| 1507 | 1507 | function bp_get_the_thread_recipients(){ |
| 1508 | | return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) ); |
| | 1508 | if ( 5 <= bp_get_thread_recipients_count() ) { |
| | 1509 | return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%s recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ) ); |
| | 1510 | } else { |
| | 1511 | return bp_get_thread_recipients_list(); |
| | 1512 | } |
| 1509 | 1513 | } |
| | 1514 | |
| 1510 | 1515 | |
| 1511 | 1516 | /** |
| 1512 | 1517 | * 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
|
b
|
|
| 15 | 15 | |
| 16 | 16 | <?php else : ?> |
| 17 | 17 | |
| 18 | | <?php if ( 10 <= bp_get_thread_recipients_count() ) : ?> |
| | 18 | <?php if ( 5 <= bp_get_thread_recipients_count() ) : ?> |
| 19 | 19 | |
| 20 | 20 | <?php printf( __( 'Conversation between %s recipients.', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?> |
| 21 | 21 | |
--
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
|
b
|
function bp_the_thread_subject() {
|
| 1499 | 1499 | |
| 1500 | 1500 | /** |
| 1501 | 1501 | * Get the number of recipients in the current thread using number_format_i18n |
| | 1502 | * This function was originally used in user messages single.php and was split into the functions that follow it |
| | 1503 | * It's been modified to use the new functions and kept in case anyone is using in their theme |
| 1502 | 1504 | * |
| 1503 | | * @uses bp_get_thread_recipients_count() |
| | 1505 | * @uses bp_get_thread_recipients_count() |
| | 1506 | * @uses bp_get_thread_recipients_list |
| 1504 | 1507 | * |
| 1505 | 1508 | * @return string |
| 1506 | 1509 | */ |