bp_groups_admin_edit_metabox_group_type( BP_Groups_Group|null $group = null )

Render the Group Type metabox.

Description

Parameters

$group

(Optional) The BP_Groups_Group object corresponding to the group being edited.

Default value: null

Source

File: bp-groups/bp-groups-admin.php

function bp_groups_admin_edit_metabox_group_type( BP_Groups_Group $group = null ) {

	// Bail if no group ID.
	if ( empty( $group->id ) ) {
		return;
	}

	$types         = bp_groups_get_group_types( array(), 'objects' );
	$current_types = (array) bp_groups_get_group_type( $group->id, false );
	$backend_only  = bp_groups_get_group_types( array( 'show_in_create_screen' => false ) );
	?>

	<div class="bp-groups-settings-section" id="bp-groups-settings-section-group-type">
		<select id="bp-groups-group-type" name="bp-groups-group-type[]" autocomplete="off">
			<option value="" <?php selected( '', $current_types[0] ); ?>><?php _e( 'Select Group Type', 'buddyboss' ); ?></option>
			<?php


			foreach ( $types as $type ) :
				?>
				<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $current_types[0], $type->name ); ?>><?php echo esc_html( $type->labels['singular_name'] ); ?></option>
				<?php
			endforeach;

			?>
		</select>
	</div>

	<?php

	wp_nonce_field( 'bp-group-type-change-' . $group->id, 'bp-group-type-nonce' );
}

Changelog

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