• Knowledge Base
    • All Articles
    • BuddyBoss Platform
    • BuddyBoss Theme
    • BuddyBoss App
    • Integrations
    • Advanced Setup
    • Troubleshooting
    • Release Notes
      • BuddyBoss Platform
      • BuddyBoss Platform Pro
      • BuddyBoss Theme
      • BuddyBoss App
      • BuddyBoss App Plugin
      • Other Products
  • Developers
    • Developer Tutorials
      • Web Development
      • App Development
    • Code Reference
      • Functions
      • Hooks
      • Classes
      • Methods
      • Commands
      • App Codex
    • REST API
      • BuddyBoss Platform
      • BuddyBoss App
    • Font Cheatsheet
    • Github Project
  • Roadmap
  • Go to BuddyBoss
    Contact Support
    Filter
    • Knowledge Base
      • All Articles
      • BuddyBoss Platform
      • BuddyBoss Theme
      • BuddyBoss App
      • Integrations
      • Advanced Setup
      • Troubleshooting
      • Release Notes
        • BuddyBoss Platform
        • BuddyBoss Platform Pro
        • BuddyBoss Theme
        • BuddyBoss App
        • BuddyBoss App Plugin
        • Other Products
    • Developers
      • Developer Tutorials
        • Web Development
        • App Development
      • Code Reference
        • Functions
        • Hooks
        • Classes
        • Methods
        • Commands
        • App Codex
      • REST API
        • BuddyBoss Platform
        • BuddyBoss App
      • Font Cheatsheet
      • Github Project
    • Roadmap
    • Go to BuddyBoss
    Filter
    Filter

    Contents

    • Description
    • Return
    • Source
    • Related
    Code Reference Classes BP_REST_Account_Settings_Options_Endpoint BP_REST_Account_Settings_Options_Endpoint::get_notifications_fields()

    BP_REST_Account_Settings_Options_Endpoint::get_notifications_fields()

    Get Fields for the Notifications “Email Preferences”.

    Description

    • From: ‘members/single/settings/notifications’

    Return

    (array|mixed|void)

    Source

    File: bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php

    	public function get_notifications_fields() {
    		$fields = array();
    
    		if ( bp_is_active( 'activity' ) ) {
    			$fields_activity[] = array(
    				'name'        => '',
    				'label'       => '',
    				'field'       => '',
    				'value'       => '',
    				'options'     => array(),
    				'group_label' => __( 'Activity Feed', 'buddyboss' ),
    			);
    
    			if ( bp_activity_do_mentions() ) {
    				$fields_activity[] = array(
    					'name'        => 'notification_activity_new_mention',
    					'label'       => sprintf(
    					/* translators: %s: users mention name. */
    						__( 'A member mentions you in an update using "@%s"', 'buddyboss' ),
    						bp_activity_get_user_mentionname( bp_loggedin_user_id() )
    					),
    					'field'       => 'radio',
    					'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_activity_new_mention', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_activity_new_mention', true ) : 'yes' ),
    					'options'     => array(
    						'yes' => 'Yes',
    						'no'  => 'No',
    					),
    					'group_label' => '',
    				);
    			}
    
    			$fields_activity[] = array(
    				'name'        => 'notification_activity_new_reply',
    				'label'       => __( "A member replies to an update or comment you've posted", 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_activity_new_reply', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_activity_new_reply', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_activity = apply_filters( 'bp_rest_account_settings_notifications_activity', $fields_activity );
    			$fields          = array_merge( $fields, $fields_activity );
    		}
    
    		if ( bp_is_active( 'messages' ) ) {
    			$fields_messages[] = array(
    				'name'        => '',
    				'label'       => '',
    				'field'       => '',
    				'value'       => '',
    				'options'     => array(),
    				'group_label' => __( 'Messages', 'buddyboss' ),
    			);
    
    			$fields_messages[] = array(
    				'name'        => 'notification_messages_new_message',
    				'label'       => __( 'A member sends you a new message', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_messages_new_message', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_messages_new_message', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_messages = apply_filters( 'bp_rest_account_settings_notifications_messages', $fields_messages );
    			$fields          = array_merge( $fields, $fields_messages );
    		}
    
    		if ( bp_is_active( 'groups' ) ) {
    			$fields_groups[] = array(
    				'name'        => '',
    				'label'       => '',
    				'field'       => '',
    				'value'       => '',
    				'options'     => array(),
    				'group_label' => __( 'Social Groups', 'buddyboss' ),
    			);
    
    			$fields_groups[] = array(
    				'name'        => 'notification_groups_invite',
    				'label'       => __( 'A member invites you to join a group', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_invite', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_invite', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_groups[] = array(
    				'name'        => 'notification_groups_group_updated',
    				'label'       => __( 'Group information is updated', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_group_updated', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_group_updated', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_groups[] = array(
    				'name'        => 'notification_groups_admin_promotion',
    				'label'       => __( 'You are promoted to a group organizer or moderator', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_admin_promotion', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_admin_promotion', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_groups[] = array(
    				'name'        => 'notification_groups_membership_request',
    				'label'       => __( 'A member requests to join a private group you organize', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_membership_request', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_groups_membership_request', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_groups[] = array(
    				'name'        => 'notification_membership_request_completed',
    				'label'       => __( 'Your request to join a group has been approved or denied', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_membership_request_completed', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_membership_request_completed', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			if ( function_exists( 'bp_disable_group_messages' ) && true === bp_disable_group_messages() ) {
    				$fields_groups[] = array(
    					'name'        => 'notification_group_messages_new_message',
    					'label'       => __( 'Group Message', 'buddyboss' ),
    					'field'       => 'radio',
    					'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_group_messages_new_message', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_group_messages_new_message', true ) : 'yes' ),
    					'options'     => array(
    						'yes' => 'Yes',
    						'no'  => 'No',
    					),
    					'group_label' => '',
    				);
    			}
    
    			$fields_groups = apply_filters( 'bp_rest_account_settings_notifications_groups', $fields_groups );
    			$fields        = array_merge( $fields, $fields_groups );
    		}
    
    		if ( bp_is_active( 'friends' ) ) {
    			$fields_friends[] = array(
    				'name'        => '',
    				'label'       => '',
    				'field'       => '',
    				'value'       => '',
    				'options'     => array(),
    				'group_label' => __( 'Connections', 'buddyboss' ),
    			);
    
    			$fields_friends[] = array(
    				'name'        => 'notification_friends_friendship_request',
    				'label'       => __( 'A member invites you to connect', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_friends_friendship_request', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_friends_friendship_request', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_friends[] = array(
    				'name'        => 'notification_friends_friendship_accepted',
    				'label'       => __( 'A member accepts your connection request', 'buddyboss' ),
    				'field'       => 'radio',
    				'value'       => ( ! empty( bp_get_user_meta( bp_loggedin_user_id(), 'notification_friends_friendship_accepted', true ) ) ? bp_get_user_meta( bp_loggedin_user_id(), 'notification_friends_friendship_accepted', true ) : 'yes' ),
    				'options'     => array(
    					'yes' => 'Yes',
    					'no'  => 'No',
    				),
    				'group_label' => '',
    			);
    
    			$fields_friends = apply_filters( 'bp_rest_account_settings_notifications_friends', $fields_friends );
    			$fields         = array_merge( $fields, $fields_friends );
    		}
    
    		$fields = apply_filters( 'bp_rest_account_settings_notifications', $fields );
    
    		return $fields;
    	}
    

    Expand full source code Collapse full source code

    Related

    Uses

    Uses
    Uses Description
    bp-core/bp-core-options.php: bp_disable_group_messages()

    Are group messages disabled?

    bp-xprofile/bp-xprofile-functions.php: bp_activity_get_user_mentionname()

    Determine a user’s “mentionname”, the name used for that user in @-mentions.

    bp-core/bp-core-template.php: bp_is_active()

    Check whether a given component (or feature of a component) is active.

    bp-core/bp-core-template.php: bp_loggedin_user_id()

    Get the ID of the currently logged-in user.

    bp-core/bp-core-functions.php: bp_get_user_meta()

    Get a piece of usermeta.

    bp-activity/bp-activity-functions.php: bp_activity_do_mentions()

    Are mentions enabled or disabled?

    Show 1 more use Hide more uses

    Used By
    Used By Description
    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_item()

    Retrieve Account Settings options.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_item()

    Update Account Settings options.

    Questions?

    We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.

    © 2025 • BuddyBoss