hi @masoud1111,
all i found was how to hide that button, or remove it.
but not show it only on some profiles
You just need to add some conditionnals.
Try this (in bp-custom.php) and give feed back if it works.
function bpex_private_message_button( $button ) {
$user = bp_loggedin_user_id();
if ( is_super_admin() ) {
return $button;
}
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
if ( $role == 'subscriber' || $role == 'contributor' || $role == 'author' || $role == 'editor' ) {
// hide button for these roles
$button = '';
}
}
// allow the button to appear on admin's profile only
if ( bp_is_active( 'xprofile' ) && bp_is_user() ) {
$user_id = bp_displayed_user_id();
// assuming admin's ID is 1
if ( $user_id == 1 ) {
return $button;
}
}
}
add_filter( 'bp_get_send_message_button', 'bpex_private_message_button', 1 , 1 );
hi @danbp , and so many manyyy thanks for your help.
it worked like a charm ^_^