buddypress remove username from autocomplete

I am using Wordpress and Buddypress and i am trying to remove or hide the username that is being displayed in the autocomplete field of messages in Buddypress. Tried some tests from this post and also this , but with no luck. Did someone run into this issue?

I was also looking around if i could just hide it with some css, but i think is not possible since the html is like that :

li class="ac_event ac_over"span id="link-username" href="#"/span
img src="https://www.test.com/wp-content/uploads/avatars/23/user-bpthumb.jpg" style="width: 15px" nbsp; User (strongU/strongsername)/li

and need to remove (strongU/strongsername) I have also tried to remove or add some html span inside the native bp code

'span id="%s" href="#"/spanimg src="%s" style="width: 15px"   %s (%s)' . "\n",  
            esc_attr( 'link-' . $user-ID ),  
            esc_url( $user-image ),  
            esc_html( $user-name ),  
            esc_html( $user-ID )

but when i try to remove (%s) it just breaks the displayed result.

Topic username autocomplete buddypress customization Wordpress

Category Web


So i managed to solve this problem with some CSS, unfortunately there is no possibility to wrap with any html element around (%s) , BUT there is possibility to wrap with html the rest. So i did this

printf( '<span id="keep"><span id="%s" href="#"></span><img src="%s" style="width: 15px"> &nbsp; %s</span> (%s)' . "\n",

with out removing nothing from the original code, just adding the span 'keep' and then with the classic css visibility:hidden; trick i managed to hide it simple.


Try this but note that it may not send the message:

'<span id="%s" href="#"></span><img src="%s" style="width: 15px">   %s %s' . "\n",  
            esc_attr( 'link-' . $user->ID ),  
            esc_url( $user->image ),  
            esc_html( $user->name ),  
            ' '

Or this:

'<span id="%s" href="#"></span><img src="%s" style="width: 15px">   %s' . "\n",  
            esc_attr( 'link-' . $user->ID ),  
            esc_url( $user->image ),  
            esc_html( $user->name ) 

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.