Im trying to display user login instead of user full name below each post avatar. Im using the following hook:
function my_member_username_link() {
global $post;
if (isset($post->post_author)) {
$user_info = get_userdata($post->post_author);
return '<a href="/' . $user_info->user_login . '/" title="' . $user_info->user_login . '">' . $user_info->user_login . '</a>';
}
}
add_filter('bp_core_get_userlink','my_member_username_link');
This works on each avatar close to each post, but acts weird in the right sidebar where my session is displayed.
Any help is welcome.
Thanks in advance.