Reply To: Change “title” attribute in Who’s Online Widget
The easiest way would be to create your own widget, as this widget is in a core file (bp-members/bp-members-widgets.php). Then you can ignore the built in widget and use yours.
Line 307 > 309 is a div containing what you have to modify.
<div class="item-avatar">
<a href="<?php bp_member_permalink(); ?>" title="<?php bp_member_name(); ?>"><?php bp_member_avatar(); ?></a>
</div>
Change bp_member_name() to bp_member_user_nicename()
Code related to who’s online goes from line 247 to 390.
– Copy/paste it to bp-custom.php
– change class name to something unique. ie. class My_Whos_Online_Widget extends WP_Widget
– in __construct function, in $name replace (BuddyPress by Custom)
– modify the div content by replacing bp_member_name() by bp_member_user_nicename()
Done !
You have to register the new widget. In bp-custom
function register_my_custom_widget() {
register_widget( 'My_Whos_Online_Widget' );
}
add_action( 'widgets_init', 'register_my_custom_widget' );
Go to Appearance > Widget and select (Custom) Who’s Online Widget.
Finito ! 🙂