groups_screen_group_invite()

Handle the display of a group’s Send Invites page.

Description

Source

File: bp-groups/screens/single/invite.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
55
56
57
58
59
60
function groups_screen_group_invite() {
 
    if ( !bp_is_single_item() )
        return false;
 
    $bp = buddypress();
 
    if ( bp_is_action_variable( 'send', 0 ) ) {
 
        if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) )
            return false;
 
        if ( !empty( $_POST['friends'] ) ) {
            foreach( (array) $_POST['friends'] as $friend ) {
                groups_invite_user( array( 'user_id' => $friend, 'group_id' => $bp->groups->current_group->id ) );
            }
        }
 
        // Send the invites.
        groups_send_invites( bp_loggedin_user_id(), $bp->groups->current_group->id );
        bp_core_add_message( __('Group invites sent.', 'buddyboss') );
 
        /**
         * Fires after the sending of a group invite inside the group's Send Invites page.
         *
         * @since BuddyPress 1.0.0
         *
         * @param int $id ID of the group whose members are being displayed.
         */
        do_action( 'groups_screen_group_invite', $bp->groups->current_group->id );
        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
 
    } elseif ( !bp_action_variable( 0 ) ) {
 
        /**
         * Filters the template to load for a group's Send Invites page.
         *
         * @since BuddyPress 1.0.0
         *
         * @param string $value Path to a group's Send Invites template.
         */
        bp_core_load_template( apply_filters( 'groups_template_group_invite', 'groups/single/home' ) );
 
    } else {
        bp_do_404();
    }
}

Changelog

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