Introduction
BuddyBoss sends email notifications for new private messages and message notices. The platform does not provide a built-in option to disable these notifications for users by default. You can achieve this by adding a small custom function to your active theme. This guide will explain how to disable direct message email notifications for logged-In users.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- Go to Appearance > Theme Editor in your WordPress admin dashboard.
- Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
- From the Theme Files list, open Theme Functions (functions.php).
- Add the following code just before the closing PHP tag (?>):
function bp_set_notification_default( $user_id ) {
$keys = array(
'notification_messages_new_message',
'notification_messages_new_notice'
);
foreach ( $keys as $key ) {
update_user_meta( $user_id, $key, 'no' );
}
}
add_action( 'bp_core_signup_user', 'bp_set_notification_default', 100, 1 );- Click Update File to save the changes.
This code disables email notifications for:
- New private messages
- New message notices
In-app notifications and messages will continue to function normally.
Troubleshooting and FAQs
Q: Existing users are still receiving email notifications.
A: This code applies to users when the action hook runs (newly registered users). For existing users, you may need to update their user meta manually or run a one-time script.
Q: Does this disable in-app notifications?
A: No. Only email notifications are affected. Messages will still appear in the user’s inbox and notification panel.
Q: Can users turn email notifications back on themselves?
A: Yes, unless you restrict notification settings elsewhere.
Q: Can I disable this only for specific user roles?
A: Yes. You can modify the function to check user roles before updating notification preferences.
Q: Can I revert this change easily?
A: Yes. Remove or comment out the code from functions.php and save the file.