bp_user_can_create_groups()
Determine if the current logged in user can create groups.
Description
Return
(bool) True if user can create groups. False otherwise.
Source
File: bp-groups/bp-groups-template.php
function bp_user_can_create_groups() { // Super admin can always create groups. if ( bp_current_user_can( 'bp_moderate' ) ) { return true; } // Get group creation option, default to 0 (allowed). $restricted = (int) bp_get_option( 'bp_restrict_group_creation', 0 ); // Allow by default. $can_create = true; // Are regular users restricted? if ( $restricted ) { $can_create = false; } /** * Filters if the current logged in user can create groups. * * @since BuddyPress 1.5.0 * * @param bool $can_create Whether the person can create groups. * @param int $restricted Whether or not group creation is restricted. */ return apply_filters( 'bp_user_can_create_groups', $can_create, $restricted ); }
Changelog
Version | Description |
---|---|
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.