Forked from BoweFrankema/bp-default-notification-settings.php
Created
January 22, 2017 19:42
-
-
Save fervous/04b0ec8dd5604f778836d64d7bd96f67 to your computer and use it in GitHub Desktop.
Default BuddyPress Notification Settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'bp_core_activated_user', 'bpdev_set_email_notifications_preference'); | |
function bpdev_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 ); | |
} | |
//that's it. have fun! | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment