Source: Topic: Private Message Friends Only · BuddyPress.org | https://buddypress.org/
Category Archives: wordpress
Topic: Resctrict private messages · BuddyPress.org | https://buddypress.org/
Private Messaging | Bp-rest-api Handbook Handbook | BuddyPress Developer Resources | https://developer.buddypress.org/
filters | Buddypress | hookr.io | http://hookr.io/
The WordPress Hook/API Index
Private Messaging | Bp-rest-api Handbook Handbook | BuddyPress Developer Resources | https://developer.buddypress.org/
How to hide Send Private Message and Send Public Message – BuddyPress User | https://buddyuser.com/
How to Hide Send Private Message and Send Public Message from the members profile view
Sometimes it becomes prudent to make it more difficult for site members to email other members, for example where you are suffering from spammers.
Where to put code Snippets
Code Snippets for BuddyPress can typically be placed in two locations:
/wp-content/themes/yourchildtheme/functions.php/wp-content/plugins/bp-custom.phpThe preference is to create a bp-custom.php file, since this is independent of the theme you happen to be using.
The code snippet must be wrapped in <?php and ?> tags in order to tell you server that it is to run the code as PHP.
Remove “Send Private Message” from users who are not friends of the member whose profile they are viewing
1 2 3 4 5 6 7add_filter( 'bp_get_send_message_button', function( $array ) { if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) { return $array; } else { return ''; } } );Remove “Send Public Message” from users who are not friends of the member whose profile they are viewing
1 2 3 4 5 6 7 8add_filter( 'bp_get_send_public_message_button', function( $r ) { if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) { return $r; } else { $r['component'] = ''; return $r; } } );These code snippets were originally posted by Henry Wright in the BuddyPress Forums:
https://buddypress.org/support/topic/disable-or-hide-private-message-button/
Source: How to hide Send Private Message and Send Public Message – BuddyPress User | https://buddyuser.com/
BP_Messages_Message – BuddyBoss Resources
classBP_Messages_Message {publicstatic$last_inserted_id;/*** ID of the message.** @var int*/public$id;/*** ID of the message thread.** @var int*/public$thread_id;/*** ID of the sender.** @var int*/public$sender_id;/*** Subject line of the message.** @var string*/public$subject;/*** Content of the message.** @var string*/public$message;/*** Date the message was sent.** @var string*/public$date_sent;/*** Message recipients.** @var bool|array*/public$recipients= false;/*** Constructor.** @param int|null $id Optional. ID of the message.*/publicfunction__construct($id= null ) {$this->date_sent = bp_core_current_time();$this->sender_id = bp_loggedin_user_id();if( !empty($id) ) {$this->populate($id);}}
Using Themes | WordPress.org
Source: Using Themes | WordPress.org