bp_settings_action_notifications()

Handles the changing and saving of user notification settings.

Description

Source

File: bp-settings/actions/notifications.php

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function bp_settings_action_notifications() {
    if ( ! bp_is_post_request() ) {
        return;
    }
 
    // Bail if no submit action.
    if ( ! isset( $_POST['submit'] ) ) {
        return;
    }
 
    // Bail if not in settings.
    if ( ! bp_is_settings_component() || ! bp_is_current_action( 'notifications' ) ) {
        return false;
    }
 
    // 404 if there are any additional action variables attached
    if ( bp_action_variables() ) {
        bp_do_404();
        return;
    }
 
    check_admin_referer( 'bp_settings_notifications' );
 
    bp_settings_update_notification_settings( bp_displayed_user_id(), (array) $_POST['notifications'] );
 
    // Switch feedback for super admins.
    if ( bp_is_my_profile() ) {
        bp_core_add_message( __( 'Your notification settings have been saved.',        'buddyboss' ), 'success' );
    } else {
        bp_core_add_message( __( "This user's notification settings have been saved.", 'buddyboss' ), 'success' );
    }
 
    /**
     * Fires after the notification settings have been saved, and before redirect.
     *
     * @since BuddyPress 1.5.0
     */
    do_action( 'bp_core_notification_settings_after_save' );
 
    bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications/' );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

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.