bp_groups_user_can_send_invites( int $group_id, int $user_id )
Can a user send invitations in the specified group?
Description
Parameters
- $group_id
-
(Required) The group ID to check.
- $user_id
-
(Required) The user ID to check.
Return
(bool)
Source
File: bp-groups/bp-groups-template.php
3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 | function bp_groups_user_can_send_invites( $group_id = 0, $user_id = 0 ) { $can_send_invites = false; $invite_status = false; // If $user_id isn't specified, we check against the logged-in user. if ( ! $user_id ) { $user_id = bp_loggedin_user_id(); } // If $group_id isn't specified, use existing one if available. if ( ! $group_id ) { $group_id = bp_get_current_group_id(); } if ( $user_id ) { $can_send_invites = bp_user_can( $user_id , 'groups_send_invitation' , array ( 'group_id' => $group_id ) ); } /** * Filters whether a user can send invites in a group. * * @since BuddyPress 1.5.0 * @since BuddyPress 2.2.0 Added the $user_id parameter. * * @param bool $can_send_invites Whether the user can send invites * @param int $group_id The group ID being checked * @param bool $invite_status The group's current invite status * @param int $user_id The user ID being checked */ return apply_filters( 'bp_groups_user_can_send_invites' , $can_send_invites , $group_id , $invite_status , $user_id ); } |
Changelog
Version | Description |
---|---|
BuddyPress 2.2.0 Added the $user_id parameter. | BuddyPress 2.2.0 Added the $user_id parameter. |
BuddyPress 1.5.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.