bp_group_type_permissions_meta_box( WP_Post $post )
Generate Group Type Permissions Meta box.
Description
Parameters
- $post
-
(WP_Post) (Required)
Source
File: bp-groups/bp-groups-admin.php
function bp_group_type_permissions_meta_box( $post ) { $meta = get_post_custom( $post->ID ); ?> <?php $enable_filter = isset( $meta[ '_bp_group_type_enable_filter' ] ) ? $meta[ '_bp_group_type_enable_filter' ][ 0 ] : 0; //disabled by default ?> <table class="widefat bp-postbox-table"> <thead> <tr> <th scope="col" colspan="2"> <?php _e( 'Groups Directory', 'buddyboss' ); ?> </th> </tr> </thead> <tbody> <tr> <td colspan="2"> <input type='checkbox' name='bp-group-type[enable_filter]' value='1' <?php checked( $enable_filter, 1 ); ?> /> <?php _e( 'Display this group type in "Types" filter in Groups Directory', 'buddyboss' ); ?> </td> </tr> <tr> <td colspan="2"> <?php $enable_remove = isset( $meta[ '_bp_group_type_enable_remove' ] ) ? $meta[ '_bp_group_type_enable_remove' ][ 0 ] : 0; //enabled by default ?> <input type='checkbox' name='bp-group-type[enable_remove]' value='1' <?php checked( $enable_remove, 1 ); ?> /> <?php _e( 'Hide all groups of this type from Groups Directory', 'buddyboss' ); ?> </td> </tr> </tbody> </table> <?php $meta = get_post_custom( $post->ID ); $get_restrict_invites_same_group_types = isset( $meta[ '_bp_group_type_restrict_invites_user_same_group_type' ] ) ? intval( $meta[ '_bp_group_type_restrict_invites_user_same_group_type' ][ 0 ] ) : 0; //disabled by default ?> <table class="widefat bp-postbox-table"> <thead> <tr> <th scope="col" colspan="2"> <?php _e( 'Group Type Invites', 'buddyboss' ); ?> </th> </tr> </thead> <tbody> <tr> <td colspan="2"> <input type='checkbox' name='bp-group-type-restrict-invites-user-same-group-type' value='<?php echo esc_attr( 1 ); ?>' <?php checked( $get_restrict_invites_same_group_types, 1 ); ?> /> <?php _e( 'If a member is already in a group of this type, they cannot be sent an invite to join another group of this type.', 'buddyboss' ); ?> </td> </tr> </tbody> </table> <?php // Register following sections only if "profile types" are enabled. if ( true === bp_member_type_enable_disable() ) { $get_all_registered_member_types = bp_get_active_member_types(); if ( isset( $get_all_registered_member_types ) && !empty( $get_all_registered_member_types ) ) { ?> <table class="widefat bp-postbox-table"> <thead> <tr> <th scope="col" colspan="2"> <?php _e( 'Profile Type Invites', 'buddyboss' ); ?> </th> </tr> </thead> <tbody> <tr> <td colspan="2"> <?php _e( 'Only members of the selected profile types may be sent requests to join this group. (Leave blank for unrestricted invites)', 'buddyboss' ); ?> </td> </tr> <?php $get_all_registered_member_types = bp_get_active_member_types(); $get_selected_member_types = get_post_meta( $post->ID, '_bp_group_type_enabled_member_type_group_invites', true ) ?: []; foreach ( $get_all_registered_member_types as $member_type ) { $member_type_key = bp_get_member_type_key( $member_type ); ?> <tr> <td colspan="2"> <input type='checkbox' name='bp-member-type-group-invites[]' value='<?php echo esc_attr( $member_type_key ); ?>' <?php checked( in_array( $member_type_key, $get_selected_member_types ) ); ?> /> <?php _e( get_the_title( $member_type ), 'buddyboss' ); ?> </td> </tr> <?php } ?> </tbody> </table> <table class="widefat bp-postbox-table"> <thead> <tr> <th scope="col" colspan="2"> <?php _e( 'Profile Type Joining', 'buddyboss' ); ?> </th> </tr> </thead> <tbody> <tr> <td colspan="2"> <?php _e( 'Members of the selected profile types can always join groups of this type, even if the group is private.', 'buddyboss' ); ?> </td> </tr> <?php $get_all_registered_member_types = bp_get_active_member_types(); $get_selected_member_types = get_post_meta( $post->ID, '_bp_group_type_enabled_member_type_join', true ) ?: []; foreach ( $get_all_registered_member_types as $member_type ) { $member_type_key = bp_get_member_type_key( $member_type ); ?> <tr> <td colspan="2"> <input type='checkbox' name='bp-member-type[]' value='<?php echo esc_attr( $member_type_key ); ?>' <?php checked( in_array( $member_type_key, $get_selected_member_types ) ); ?> /> <?php _e( get_the_title( $member_type ), 'buddyboss' ); ?> </td> </tr> <?php }?> </tbody> </table> <?php } } }
Changelog
Version | Description |
---|---|
BuddyBoss 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.