Additional info on group memberlist
-
Hi
I could add some additonal info on the group memberlist near each member. As you see on the screenshot, on the right hand there are links for chat and email. A loggedin member should not see them near his/her username. They will never send email to/chat with themselves. They only need to see other persons’ links.Can anyone point me to the right codex page or give a hint in order to find how to hide them?
Thanks in advanceWP 4.8.2
BP 2.9.1
-
Hi Georgio-
It depends on how they’re being added. I’m guessing that they’re being added (by a plugin?) on the
bp_group_members_list_item_action
orbp_group_members_list_item
action hook. If I were adding a button in that case, I’d add a conditional like in this example:add_action( 'bp_group_members_list_item', 'conditional_group_member_list_item' ); function conditional_group_member_list_item() { // Check the member list item member ID against the current user's ID // Only show added info if the user is not the current user. if ( bp_get_group_member_id() != bp_loggedin_user_id() ) { ?> <span>This is NOT me.</span> <?php } else { // This member listing is the current user. ?> <span>This is me.</span> <?php } }
This is just in theory, as my install doesn’t show any actions buttons for the current user in the list anyway, but you could try just hiding the buttons with this CSS:
ul#members-list li.is-current-user div.action { display: none; }
Obviously I can’t test that though but it should work if your theme also uses the BP Legacy templates.
Hope that helps
Hi @dcavins
The button Chat is a shortcode of the plugin Frontend PM. I meanwhile contacted its developer and he gave me a code like yours and that resolved the problem.
The Email link is from code I found on the internet and displays info from a profile field. I did not test your code with it, because I thought that it may be finally a good idea for the members to send email to themselves as reminders or for keeping notes for the groups they are members of.
Thank you for your help
—-
Hi @petervandoornThis code helps if the selector
.is-current-user
is displayed. I find it in the sitewide members directory but not in the groups members directory and I dont know the reason since I use BP Legacy templates.Thanks for your help
- You must be logged in to reply to this topic.