Skip to:
Content

BuddyPress.org

Ticket #6935: 6935.2.patch

File 6935.2.patch, 2.1 KB (added by imath, 9 years ago)
  • src/bp-messages/bp-messages-cssjs.php

    diff --git src/bp-messages/bp-messages-cssjs.php src/bp-messages/bp-messages-cssjs.php
    index 33cdf16..b4095ef 100644
    function messages_autocomplete_init_jsblock() { 
    6868                                var users = document.getElementById('send-to-usernames').className;
    6969                                document.getElementById('send-to-usernames').value = String(users);
    7070                        });
     71
     72                        /**
     73                         * This part is a temporary fix to make sure the recipient added using PHP
     74                         * is not a li nested in another li and is displayed like autocomplete results.
     75                         *
     76                         * The correct fix would be to put the <?php bp_message_get_recipient_tabs(); ?>
     77                         * before the li in bp-templates/members/single/messages/compose.php
     78                         *
     79                         * @see https://buddypress.trac.wordpress.org/ticket/6935
     80                         */
     81                        var move = false;
     82
     83                        jQuery( 'ul.first.acfb-holder li' ).each( function( i, element ) {
     84                                if ( jQuery( element ).hasClass( 'friend-tab' ) ) {
     85                                        move = jQuery( element );
     86                                }
     87                        } );
     88
     89                        if ( false !== move ) {
     90                                jQuery( 'ul.first.acfb-holder li' ).first().html( jQuery( '#send-to-input' ) ).before( move );
     91                        }
    7192                });
    7293        </script>
    7394
  • src/bp-messages/bp-messages-template.php

    diff --git src/bp-messages/bp-messages-template.php src/bp-messages/bp-messages-template.php
    index b5b7f8e..a765842 100644
    function bp_message_get_recipient_tabs() { 
    13801380                if ( ! empty( $user_id ) ) : ?>
    13811381
    13821382                        <li id="un-<?php echo esc_attr( $recipient ); ?>" class="friend-tab">
    1383                                 <span><?php
    1384                                         echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) );
    1385                                         echo bp_core_get_userlink( $user_id );
    1386                                 ?></span>
     1383                                <span>
     1384                                        <?php printf( '<a href="%1$s">%2$s &nbsp; %3$s</a>',
     1385                                                esc_url( bp_core_get_user_domain( $user_id ) ),
     1386                                                bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15, 'class' => '' ) ),
     1387                                                esc_html( bp_core_get_user_displayname( $user_id ) )
     1388                                        ); ?>
     1389                                </span>
    13871390                        </li>
    13881391
    13891392                <?php endif;