users profile link
-
Hi!
We would like to add profile links to user avatars and names in the chat.
Currently we implemented this code based on the documentation of the plugin:
/**
* Replacing user profile URL
*/
add_filter('better_messages_rest_user_item', 'activate_user_url', 100, 3 );
function activate_user_url( $item, $user_id, $include_personal ){
$item['url'] = true;
return $item;
}And it makes the avatar and name display a tooltip ‘Go to user’s profile’ but there is no link. So we tried adding this line:
$item['url'] = get_author_posts_url( $author_id );
//So now became:
$item['url'] = true;
$item['url'] = get_author_posts_url( $author_id );
return $item;Now the avatar and user name display links but the url is not valid (all users link go to the same url: ‘ mywebsite.com/author/’ that givesback a 404 bc it doesn’t exist).
How can we make this be linked to the proper user profile url? (in our case we are using the url structure ‘mywebsite.com/user_role/user_id).
Looking fwd to your comments.
Best!
- You must be logged in to reply to this topic.