Home Forums WTI Like Post PRO Customize The User Likes Name Reply To: Customize The User Likes Name

#260
Webtechideas
Keymaster

The function GetWtiUserLikes needs to be slightly modified to allow this. Open wti_like_post.php file using any editor and search for the above function.

You need to change $users[] = $user_info->display_name; to $users[] = apply_filters( 'wti_like_post_user_profile_link', $user_info->display_name, $user_id );

This will allow attaching a function to the filter to modify the default output. Now let’s define a function related to the above filter as below.

add_filter('wti_like_post_user_profile_link', 'WtiLikePostUserProfileLink', 10, 2);

function WtiLikePostUserProfileLink($display_name, $user_id)
{
	return bp_core_get_userlink( $user_id );
}

Please note that if you are logged in and have liked a post, then it will show You instead of your display name where you have liked. If you want to change that as well, then change $users[] = __('You', 'wti-like-post'); to $users[] = apply_filters( 'wti_like_post_user_profile_link', __('You', 'wti-like-post'), $current_user->ID);

For more details on the above function which gives you the buddypress profile link, please check here.

Thanks