WordPress Hack: Turning Off BuddyPress Notifications By Default

mikevanwinkle's picture

By default BuddyPress has all sorts of email notifications turned on. This is great unless you have a big site with lots of activity and site-wide discussions. Then new users start getting pinged repeatedly on discussions they don't want to follow or don't even know they are apart of! So you may want BuddyPress to turn the notifications off by default. But there's no clear way to do this in the admin. Well, here's the golden function.

function bp_set_notification_default($user_id) {
$keys = array('notification_activity_new_mention','notification_activity_new_reply','notification_friends_friendship_accepted','notification_friends_friendship_request','notification_groups_admin_promotion','notification_groups_group_updated','notification_groups_invite','notification_groups_membership_request','notification_messages_new_message','notification_messages_new_notice');
foreach($keys as $key) {

Please note that this function is hooked to bp_core_user_signup which means existing users still have to manually turn off notifications. But you could easily run this function on an array of user_ids to change the defaults for existing users.



This looks great, but could you outline which file we need to enter the code on?

Nvm, i chucked it into the theme's function.php and its working like a charm.

Thanks a bunch!

functions.php should work, but in an ideal world you put all your BuddyPress mods in a custom plugin. The reason for this is that some buddypress hooks cannot be accessed from the theme functions.php because they have already fired before the file is loaded. So if you are making lots of mods to BP core you should really do a custom plugin.

Okay so I added the code to my functions.php file, right before the code I am using to hide my admin account from the activity stream. I hope it works, but guess I will find out when someone finally joins.

Have you by any chance any idea on how to hide the admin account from not showing up on the "Members Directory" page?

I just had to do this for a client. Will post the solution soon.

you can also go to your cpanel > phpmyadmin > ur database > sql

then execute this sql statement

update wp_usermeta
set meta_value = 'no'
where meta_key like 'notification_%'


Indeed, that'll do it too!

U Rock

Good day! This is my first visit to your blog!
We are a team of volunteers and starting a new
initiative in a community in the same niche. Your blog provided
us valuable information to work on. You have done a marvellous job!

Wonderful beat ! I would like to apprentice while you amend your site, how can i
subscribe for a weblog site? The account helped me a acceptable deal.

I have been a little bit acquainted of this your
broadcast offered vibrant transparent concept

my website: seo Google (Kiera)

Greetings! Quick question that's completely off topic.

Do you know how to make your site mobile friendly?
My website looks weird when viewing from my apple iphone. I'm trying to find a template or plugin that might be able to fix this issue.
If you have any recommendations, please share. With thanks!

You're so interesting! I do not suppose I've
truly read through something like that before. So nice to find somebody with original thoughts on this subject matter.
Seriously.. thanks for starting this up. This web site is something that is
required on the internet, someone with some originality!