bp_nouveau_groups_screen_invites_restriction()

Group invites restriction screen.

Description

Source

File: bp-templates/bp-nouveau/includes/groups/functions.php

525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
function bp_nouveau_groups_screen_invites_restriction() {
    // Redirect if no invites restriction settings page is accessible.
    if ( 'invites' !== bp_current_action() || ! bp_is_active( 'friends' ) ) {
        bp_do_404();
        return;
    }
 
    if ( isset( $_POST['member-group-invites-submit'] ) ) {
        // Nonce check.
        check_admin_referer( 'bp_nouveau_group_invites_settings' );
 
        if ( bp_is_my_profile() || bp_current_user_can( 'bp_moderate' ) ) {
            if ( empty( $_POST['account-group-invites-preferences'] ) ) {
                bp_delete_user_meta( bp_displayed_user_id(), '_bp_nouveau_restrict_invites_to_friends' );
            } else {
                bp_update_user_meta( bp_displayed_user_id(), '_bp_nouveau_restrict_invites_to_friends', (int) $_POST['account-group-invites-preferences'] );
            }
 
            bp_core_add_message( __( 'Group invites preferences saved.', 'buddyboss' ) );
        } else {
            bp_core_add_message( __( 'You are not allowed to perform this action.', 'buddyboss' ), 'error' );
        }
 
        bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() ) . 'invites/' );
    }
 
    /**
     * Filters the template to load for the Group Invites settings screen.
     *
     * @since BuddyPress 3.0.0
     *
     * @param string $template Path to the Group Invites settings screen template to load.
     */
    bp_core_load_template( apply_filters( 'bp_nouveau_groups_screen_invites_restriction', 'members/single/settings/group-invites' ) );
}

Changelog

Changelog
Version Description
BuddyPress 3.0.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.