Created
April 15, 2013 20:56
-
-
Save shanebp/5391229 to your computer and use it in GitHub Desktop.
BuddyPress - add message button in members loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_message_button_link( $link ) { | |
$link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_get_member_user_id() ) ); | |
return $link; | |
} | |
function display_private_message_button() { | |
if( bp_get_member_user_id() != bp_loggedin_user_id() ) { | |
bp_send_message_button(); | |
add_filter('bp_get_send_private_message_link', 'filter_message_button_link', 1, 1 ); | |
} | |
} | |
add_action( 'bp_directory_members_item', 'display_private_message_button' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment