BuddyDev

Search

Send Private Message Button on Member's directory if BP Messsages Plugin is used

  • Participant
    Daniel on #30694

    Hi there!

    I was trying out the code on this Buddydev blog with regards to adding a send private button on the member’s directory.

    https://buddydev.com/add-send-private-message-button-in-members-directory-on-a-buddypress-network/

    But since I am integrating BP Messages plugin on my buddypress site, it doesn’t get the required link to specific user’s BP messages.

    Whenever I click the send private message on the member’s directory, it only directs me to my generic messages page (https://prnt.sc/sxmrsc) and NOT the specific user’s direct message page(https://prnt.sc/sxmraq).

    In this case, what is the modification needed to the code?

    Regards,
    Daniel

  • Keymaster
    (BuddyDev Team)
    Posts: 24712
    Brajesh Singh on #30696

    Hi Daniel,
    Thank you for using the code..
    I do not use the better message plugin, I regret my inability to help with the link. Will suggest asking developers of the better message plugin for correct function to use.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 47
    Sotiris on #30790

    Hello Daniel,

    You could try the following code in your function.php

    
    /**
     * Get a link to send a BetterMessage PM to the given User.
     *
     * @param int $user_id user id.
     *
     * @return string
     */
    function bm_get_send_private_message_to_user_url( $user_id ) {
        return bp_loggedin_user_domain() . 'bp-messages/?new-message&fast=1&to=' . bp_core_get_username( $user_id );
    }
    
    • This reply was modified 4 years, 6 months ago by Sotiris.

You must be logged in to reply to this topic.

This topic is: not resolved