Change profile link in BuddyPress private messages

Hi there,

In the overview of BuddyPress private messages you'll see the messages which have been send to you.

I would like to change the link of the sender into a link to his message, the same link as you click on the subject of the message.

Where do I change this and how?

  • Jack Kitterhing

    Hi there @Frank,

    Hope you're well today and thanks for your question! :slight_smile:

    in BuddyPress/bp-messages/bp-messages-template.php

    You'll see this code.

    /**
     * Output a link to the sender of the current message.
     */
    function bp_the_thread_message_sender_link() {
    	echo bp_get_the_thread_message_sender_link();
    }
    	/**
    	 * Get a link to the sender of the current message.
    	 *
    	 * @return string
    	 */
    	function bp_get_the_thread_message_sender_link() {
    		global $thread_template;
    
    		return apply_filters( 'bp_get_the_thread_message_sender_link', bp_core_get_userlink( $thread_template->message->sender_id, false, true ) );
    	}

    You could create your own function to modify the output and add that to your theme functions.php.

    $message_link will get you the link you want, as $message_link is set to

    $message_link = bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() .'/';

    Thanks!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.