I need to output “Send Private Message” button on a custom profile page.
I’ve managed to add “Add Friend” button but this one is bugging me.
So far, I’ve managed to output only a link which actually works, but the problem is when I click on it, I need to type manually a user name to send message to.
I was hoping to get the functionality that when I click “Send Message”, the recipient is auto populated. Just like it’s on original buddypress profile page.
So far, I used this code..
if ( is_user_logged_in() ) echo '<a href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . get_the_author_meta('user_login') ) . '" title="Send a private message to this user" class="send-message">Private Message</a>';