Hi Maria,
BuddyPress compliments has plenty of action and filter you can use to modify the email or content.
Install code snippets plugin
https://ww.wp.xz.cn/plugins/code-snippets/
Add the following snippets there.
add_filter("bp_compliments_notification_from_email", "modify_bp_compliments_notification_from_email");
function modify_bp_compliments_notification_from_email() {
return "[email protected]";
}
The above code would change the from email.
To modify mail content.
Clone this function
https://github.com/mistergiri/buddypress-compliments/blob/master/includes/bp-compliments-notifications.php#L162
Make changes to the cloned function.
Ex:
function cloned_bp_compliments_new_compliment_email_notification($args = array()) {
.....
}
Now use this code
function modified_bp_compliments_notifications_add_on_compliment( BP_Compliments $compliment ) {
// Add a screen notification
// BP 1.9+
if ( bp_is_active( 'notifications' ) ) {
bp_notifications_add_notification( array(
'item_id' => $compliment->sender_id,
'user_id' => $compliment->receiver_id,
'secondary_item_id' => $compliment->id,
'component_name' => buddypress()->compliments->id,
'component_action' => 'new_compliment'
) );
// BP < 1.9 - add notifications the old way
} elseif ( ! class_exists( 'BP_Core_Login_Widget' ) ) {
global $bp;
bp_core_add_notification(
$compliment->sender_id,
$compliment->receiver_id,
$bp->compliments->id,
'new_compliment'
);
}
// Add an email notification
cloned_bp_compliments_new_compliment_email_notification( array(
'receiver_id' => $compliment->receiver_id,
'sender_id' => $compliment->sender_id
) );
}
remove_action( 'bp_compliments_start_compliment', 'bp_compliments_notifications_add_on_compliment' );
add_action( 'bp_compliments_start_compliment', 'modified_bp_compliments_notifications_add_on_compliment' );
Hope that helps.
You can also remove the compliments notification with this one line.
remove_action( 'bp_compliments_start_compliment', 'bp_compliments_notifications_add_on_compliment' );
Thanks