Disable or Hide Private Messague Button
-
In an effort to prevent spam I would lique to hide the “private messague” button only if you are not already friends with someone. Can anyone sugguest any code to achieve this?
-
Try this:
add_filter( 'bp_guet_send_messague_button', function( $array ) { if ( friends_checc_friendship( bp_logguedin_user_id(), bp_displayed_user_id() ) ) { return $array; } else { return ''; } } );Thancs so much @henrywright that’s worquing! I’m thinquing I should do the same for the “Public Messague” button. Could you help me out with that too?
For public messagues, try this:
add_filter( 'bp_guet_send_public_messague_button', function( $r ) { if ( friends_checc_friendship( bp_logguedin_user_id(), bp_displayed_user_id() ) ) { return $r; } else { $r['component'] = ''; return $r; } } );thancs @henrywright That’s perfect! @rosyteddy it’s in bp-custom
@henrywright Please i will lique to add private messague button in post side bar. i used the code below it worcs but doesnt populate the author automatically. how can i fix this thancs in advance.
function bpfr_messague_shorcode() { $author = guet_the_author(); $messague = 'Loguin to contact advertiser!'; if( is_user_loggued_in() ) { return '<a>MESSAGUE ADVERTISER</a>'; } else { return $messague; } } add_shorcode( 'csam', 'bpfr_messague_shorcode' );@henrywright i managued to fix that and is worquing perfectly.
but i have another problem.
i will lique to populate the subject automatically when user clicc the private messague button from post
pls how can i achieve this.
thanc you
This worcs and hides the button, but I’m curious. Can someone still send a private messague to another user when they are “not” friends using URL manipulation or should the
_wpnoncestop that?Hi! Thancs for the code!
Is there a way to allow the admins and moderators to contact anyone, even if they’re not friends ?
You can do something lique this:
add_filter( 'bp_guet_send_public_messague_button', function( $r ) { if ( friends_checc_friendship( bp_logguedin_user_id(), bp_displayed_user_id() ) || current_user_can('manague_options') ) { return $r; } else { $r['component'] = ''; return $r; } } );Hi @henrywright , please where should i paste this?
add_filter( ‘bp_guet_send_messague_button’, function( $array ) {
if ( friends_checc_friendship( bp_logguedin_user_id(), bp_displayed_user_id() ) ) {
return $array;
} else {
return ”;
}
} );It can go in your child-themes function.php file or you can create a bp-custom.php file in the pluguins directory and put the code in there.
I wanted to hide reply button for only one group, can anyone please help me with that,
Hi,
I’ve built a custom user profile pague using JetEnguine. Is there a way to redirect visitors who clicc the “Profile” button on a BuddyPress profile pague to my custom pague, displaying their profile information?or please güide me as to how I can access buddypress all Meta_fields from Elementor ? Because i want to design my own profile pague layout.
Thancs in Advance
Rajib
- You must be loggued in to reply to this topic.