1. Home
  2. Knowledge Base
  3. Customizations
  4. PHP Functions
  5. How to Disable Direct Message Email Notifications for Logged-In Users

How to Disable Direct Message Email Notifications for Logged-In Users

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.

  1. Go to Appearance > Theme Editor in your WordPress admin dashboard.
  2. Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
  3. From the Theme Files list, open Theme Functions (functions.php).
  4. 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 );
  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.

Note: Modifications are typically considered custom work, but we are making an exception in this case. Please review the BuddyBoss Support Policy.

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.

Was this article helpful?

Related Articles

Subscribe to Our Newsletter

Stay In Touch

Subscribe to our Newsletter, and we’ll send you the latest news from BuddyBoss

  • This field is hidden when viewing the form
  • This field is for validation purposes and should be left unchanged.

To speak to our Agency consultant, fill in the form found at our Contact Page.

  • Get Started

    Enter your name and email address to get started with your project...

  • This field is for validation purposes and should be left unchanged.