Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email notification default settings


  • Demiano
    Participant

    @demiano

    Hi,
    Email notification settings are set to YES for all kinds of incidents by default.

    How can I set them to NO by default, so people can actually opt to receive emails as they prefer?
    This would be an important feature and is even more important now that GDPR is araound the corner.

    I have seen a thread about it that is 3 years old and has no workable solution.
    Please help.

    Thanks,
    Demian

Viewing 5 replies - 1 through 5 (of 5 total)

  • Varun Dubey
    Participant

    @vapvarun

    @demiano You can try following codes inside your child theme functions.php or use code snippet plugin

    
    add_action( 'bp_core_activated_user', 'wb_set_email_notifications_preference');
     
    function wp_set_email_notifications_preference( $user_id ) {
     
        //I am putting all the notifications to no by default
        //you can set the value to 'yes' if you want that notification to be enabled.
        $settings_keys = array(
            'notification_activity_new_mention'         => 'no',
            'notification_activity_new_reply'           => 'no',
            'notification_friends_friendship_request'   => 'no',
            'notification_friends_friendship_accepted'  => 'no',
            'notification_groups_invite'                => 'no',
            'notification_groups_group_updated'         => 'no',
            'notification_groups_admin_promotion'       => 'no',
            'notification_groups_membership_request'    => 'no',
            'notification_messages_new_message'         => 'no',
        );
     
        foreach( $settings_keys as $setting => $preference ) {
     
            bp_update_user_meta( $user_id,  $setting, $preference );
        }
    
    }
    

    Demiano
    Participant

    @demiano

    Thanks Vapvarun, for your answer and the code.

    Unfortunately the default settings for my test user stay the same. I have no idea why.

    This issue is actually very important. The Privacy and data security regulations of the GDBR coming on 25th include strict regulations about people giving specifc consent to the emails they receive. Many people will be very sensitive about this.

    I hope there is a solution.

    Thanks,
    Demian


    Varun Dubey
    Participant

    @vapvarun


    Demiano
    Participant

    @demiano

    This worked. Thanks!


    toibox
    Participant

    @toibox

    @vapvarun

    Where can I find the documentation for the function that this thread centers on (wp_set_email_notifications_preference)? I would like to see a list of available preference values so that I properly default two additional preference types (1. Your request to join a group has been approved or denied and 2.Group Message) to ‘no’. I’ve taken a couple of blind stabs in the dark in naming them, following similar syntax and plain language to hopefully land on the right (assumed) reference (e.g. 1. ‘notification_groups_request_completed’ and 2. ‘notification_groups_group_messages’), but so far my efforts have not proven fruitful. I’ve looked for documentation on the aforementioned function in both the BP Codex and the new WP Codex (code reference) and have yet to find what I’m looking for.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.