• Resolved buzzle

    (@buzzle)


    Hi Sir,

    Thank you for this very wonderful plugin! This are my questions. Hopefully I could fix soon.

    1. How can I change the notification email of the buddypress compliments to my email [email protected] instead of my administrator email.

    Scenario: I am using SMTP and it was setup to [email protected] everything is working fine but when buddypress compliments sent email notification to the user and when they click reply button on their email (ex. gmail) they could see my administrator email which is not really secured as admin email should be kept privately.

    2. How to change or add something on the email notification Sentence?

    3. Or other solution: Is there anyway an admin can disable the email notifications totally but I don’t want the notification from the buddypress profile to be taken off. Only the email notification.

    Hoping for your help and soonest response Sir. Thank you very much.

    Maria

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Maria,

    BuddyPress compliments has plenty of action and filter you can use to modify the email or content.

    Install code snippets plugin

    https://www.ads-software.com/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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Email Notification’ is closed to new replies.