Skip to content

Instantly share code, notes, and snippets.

@shanebp
Created April 15, 2013 20:56
Show Gist options
  • Save shanebp/5391229 to your computer and use it in GitHub Desktop.
Save shanebp/5391229 to your computer and use it in GitHub Desktop.
BuddyPress - add message button in members loop
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