Skip to:
Content

BuddyPress.org

Ticket #5327: 5327.patch

File 5327.patch, 6.6 KB (added by joshshashaty, 12 years ago)
  • src/bp-messages/bp-messages-template.php

    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() {  
    14981498        }
    14991499
    15001500/**
     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 */
     1507function 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 */
     1518function bp_get_thread_recipients_count() {
     1519        global $thread_template;
     1520        return count( $thread_template->thread->recipients );
     1521}
     1522
     1523/**
    15011524 * Output HTML links to recipients in the current thread.
     1525 *
     1526 * @uses bp_get_thread_recipients_list()
     1527 * @since BuddyPress 2.2
    15021528 */
    1503 function bp_the_thread_recipients() {
    1504         echo bp_get_the_thread_recipients();
     1529function bp_the_thread_recipients_list() {
     1530        echo bp_get_thread_recipients_list();
    15051531}
    15061532        /**
    15071533         * Generate HTML links to the profiles of recipients in the current thread.
    15081534         *
    15091535         * @return string
    15101536         */
    1511         function bp_get_the_thread_recipients() {
     1537        function bp_get_thread_recipients_list() {
    15121538                global $thread_template;
    15131539
    15141540                $recipient_links = array();
    15151541
    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 
    15201542                foreach( (array) $thread_template->thread->recipients as $recipient ) {
    15211543                        if ( (int) $recipient->user_id !== bp_loggedin_user_id() ) {
    15221544                                $recipient_link = bp_core_get_userlink( $recipient->user_id );
    … … function bp_the_thread_recipients() {  
    15291551                        }
    15301552                }
    15311553
    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 ) );
    15331555        }
    15341556
    15351557/**
  • src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php

    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  
    99                <p id="message-recipients">
    1010                        <span class="highlight">
    1111
    12                                 <?php if ( !bp_get_the_thread_recipients() ) : ?>
     12                                <?php if ( !bp_get_thread_recipients_count() ) : ?>
    1313
    1414                                        <?php _e( 'You are alone in this conversation.', 'buddypress' ); ?>
    1515
    1616                                <?php else : ?>
    1717
    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; ?>                                 
    1927
    2028                                <?php endif; ?>
    2129
  • src/bp-messages/bp-messages-template.php

    -- 
    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() {  
    15051505 * @return string
    15061506 */
    15071507function 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        }
    15091513}
     1514       
    15101515
    15111516/**
    15121517 * Get the number of recipients in the current thread.
  • src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php

    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  
    1515
    1616                                <?php else : ?>
    1717
    18                                         <?php if ( 10 <= bp_get_thread_recipients_count() ) : ?>
     18                                        <?php if ( 5 <= bp_get_thread_recipients_count() ) : ?>
    1919
    2020                                                <?php printf( __( 'Conversation between %s recipients.', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?>
    2121
  • src/bp-messages/bp-messages-template.php

    -- 
    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() {  
    14991499
    15001500/**
    15011501 * 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
    15021504 *
    1503  * @uses   bp_get_thread_recipients_count()
     1505 * @uses bp_get_thread_recipients_count()
     1506 * @uses bp_get_thread_recipients_list
    15041507 *
    15051508 * @return string
    15061509 */