diff --git src/bp-messages/bp-messages-cssjs.php src/bp-messages/bp-messages-cssjs.php
index 33cdf16..8a2359a 100644
|
|
function messages_autocomplete_init_jsblock() { |
68 | 68 | var users = document.getElementById('send-to-usernames').className; |
69 | 69 | document.getElementById('send-to-usernames').value = String(users); |
70 | 70 | }); |
| 71 | |
| 72 | /** |
| 73 | * This part is a temporary fix to make sure the recipient added using PHP is not a li nested |
| 74 | * in another li and is displayed like autocomplete results. It preserves back compat with |
| 75 | * themes overriding the Messages compose screen template. |
| 76 | * |
| 77 | * The right fix would be to put the <?php bp_message_get_recipient_tabs(); ?> before the li |
| 78 | * in bp-templates/bp-legacy/buddypress/members/single/messages/compose.php. |
| 79 | * |
| 80 | * @see https://buddypress.trac.wordpress.org/ticket/6935 |
| 81 | */ |
| 82 | var move = []; |
| 83 | |
| 84 | jQuery( 'ul.first.acfb-holder li' ).each( function( i, element ) { |
| 85 | if ( jQuery( element ).hasClass( 'friend-tab' ) ) { |
| 86 | move.push( jQuery( element ) ); |
| 87 | } |
| 88 | } ); |
| 89 | |
| 90 | if ( move.length > 0 ) { |
| 91 | var first = jQuery( 'ul.first.acfb-holder li' ).first(); |
| 92 | |
| 93 | first.html( jQuery( '#send-to-input' ) ); |
| 94 | jQuery.each( move, function( i, m ) { |
| 95 | first.before( m ); |
| 96 | } ); |
| 97 | } |
71 | 98 | }); |
72 | 99 | </script> |
73 | 100 | |
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() { |
1380 | 1380 | if ( ! empty( $user_id ) ) : ?> |
1381 | 1381 | |
1382 | 1382 | <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 %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> |
1387 | 1390 | </li> |
1388 | 1391 | |
1389 | 1392 | <?php endif; |
diff --git src/bp-messages/js/autocomplete/jquery.autocompletefb.js src/bp-messages/js/autocomplete/jquery.autocompletefb.js
index a63386e..4b6a321 100644
|
|
jQuery.fn.autoCompletefb = function(options) |
53 | 53 | var un = d[1].substr(0, d[1].length-1); |
54 | 54 | |
55 | 55 | /* Don't add the same user multiple times */ |
56 | | if( 0 === jQuery(settings.inputClass).siblings('#un-' + un).length ) { |
| 56 | if( 0 === jQuery( settings.inputClass ).closest( 'ul' ).find( '#un-' + un ).length ) { |
57 | 57 | var ln = '#link-' + un; |
58 | 58 | var l = jQuery(ln).attr('href'); |
59 | 59 | var v = '<li class="'+f+'" id="un-'+un+'"><span><a href="'+l+'">'+d[0]+'</a></span> <span class="p">X</span></li>'; |