• Resolved samrot

    (@samrot)


    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!

Viewing 1 replies (of 1 total)
  • Plugin Author wordplus

    (@wordplus)

    Hi there!

    You should use something like:
    $item['url'] = 'mywebsite.com/user_role/' . $user_id;

    Please find some developer who can help you with your website customizations, I do not able to provide personal assistance to every plugin user.

    Thanks!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.