Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disabling certain email notifications by default for new members


  • jimmiejo
    Participant

    @jimmiejo

    If I’m not mistaken, all of the email notifications for members are enabled (set to Yes) by default in the notifications settings. Is there any way to customize these settings through a function to disable a few of them for all future members that register?

    I personally prefer the on-site notifications for everything but private messages, and think members of the communities I’m developing would as well.

    Thanks.

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

  • vonWolfehaus
    Member

    @vonwolfehaus

    I totally agree with this. I couldn’t find the place where to reset default notification settings, so I’m bumping this in the hopes that someone would know this.

    I believe the settings are in the my account settings under notifications


    Gayatriom
    Participant

    @gayatriom

    Yes.
    but how can we set them for ALL new members?

    I’d love this as well. Just a way to make them all off by default for all users, and let them choose to turn them on if they want.

    bump!


    Boone Gorges
    Keymaster

    @boonebgorges

    The best way to do this, at the moment, is to hook a function to one of the signup functions (perhaps the do_action hook ‘bp_core_activated_user’, found in bp-core/bp-core-signup.php), and to save a set of default settings when a user registers.


    fancyfiber
    Member

    @fancyfiber

    First thanks to Boone Gorges for the direction on how to get started with this. And for those looking for a complete answer. Add this code (or similar) to your Theme functions.php file (my apologies if there is a better way to paste code…first time posting here):

    function set_default_notifications($user_id, $key, $user) {
    $valueyes = 'yes';
    $valueno = 'no';
    
    $new_messages = bp_get_user_meta_key('notification_messages_new_message' );
    bp_update_user_meta( $user_id, $new_messages, $valueyes );
    
    $new_notices = bp_get_user_meta_key('notification_messages_new_notice' );
    bp_update_user_meta( $user_id, $new_notices, $valueno );
    
    $group_invite = bp_get_user_meta_key('notification_groups_invite' );
    bp_update_user_meta( $user_id, $group_invite, $valueyes );
    
    $group_update = bp_get_user_meta_key('notification_groups_group_updated' );
    bp_update_user_meta( $user_id, $group_update, $valueno );
    
    $group_promo = bp_get_user_meta_key('notification_groups_admin_promotion' );
    bp_update_user_meta( $user_id, $group_promo, $valueyes );
    
    $group_request = bp_get_user_meta_key('notification_groups_membership_request' );
    bp_update_user_meta( $user_id, $group_request, $valueyes );
    
    $mention = bp_get_user_meta_key('notification_activity_new_mention' );
    bp_update_user_meta( $user_id, $mention, $valueyes );
    
    $reply = bp_get_user_meta_key('notification_activity_new_reply' );
    bp_update_user_meta( $user_id, $reply, $valueyes );
    
    $send_requests = bp_get_user_meta_key('notification_friends_friendship_request' );
    bp_update_user_meta( $user_id, $send_requests, $valueyes );
    
    $accept_requests = bp_get_user_meta_key('notification_friends_friendship_accepted' );
    bp_update_user_meta( $user_id, $accept_requests, $valueno );
    do_action( 'bp_core_notification_settings_after_save' );
    
    }
    add_action('bp_core_activated_user', 'set_default_notifications', 10, 3);

    neo-tronic
    Participant

    @neo-tronic

    is there another way to disable the email notifications? this doesn’t work for me… 🙁

    can anyone help please?


    Anton
    Participant

    @nat0n

    Any new light on this one? Handling default notifications would be awesome.


    natb19
    Participant

    @natb19

    Anton, I haven’t tried it yet, but could we hook onto the user login and then run the code fancyfiber provided above?

    That way all users will have their notification settings set after they have logged in. (not perfect, but it should work!?)


    danbp
    Participant

    @danbp

    @natb19,

    you jumped in a post started over 4 years ago ! Do you really expect to reuse a snippet given over 3 years back, without having any issue ?

    Big changes came up between BP 1.0 and 2.0.2. The most change is that Notification is now a component and not a simple functionnality.

    Please open a new topic or give a try to
    BuddyPress Notification Manager. A bit old too, but it is already working with current BP.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Disabling certain email notifications by default for new members’ is closed to new replies.
Skip to toolbar