最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - buddypress remove username from autocomplete

programmeradmin2浏览0评论

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=".jpg" style="width: 15px"> &nbsp; User (<strong>U</strong>sername)</li>

and need to remove (<strong>U</strong>sername) I have also tried to remove or add some html span inside the native bp code

'<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 ),  
            esc_html( $user->ID )

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

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/wp-content/uploads/avatars/23/user-bpthumb.jpg" style="width: 15px"> &nbsp; User (<strong>U</strong>sername)</li>

and need to remove (<strong>U</strong>sername) I have also tried to remove or add some html span inside the native bp code

'<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 ),  
            esc_html( $user->ID )

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

Share Improve this question edited May 11, 2020 at 17:07 Honoluluman asked May 11, 2020 at 16:44 HonolulumanHonoluluman 351 silver badge13 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

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 ) 

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.

发布评论

评论列表(0)

  1. 暂无评论