bp_groups_admin_edit_metabox_group_type( BP_Groups_Group|null $group = null )

Render the Group Type metabox.


Parameters Parameters

$group

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

Default value: null


Source 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 ) );
	?>

	<label for="bp-groups-group-type" class="screen-reader-text"><?php
		/* translators: accessibility text */
		esc_html_e( 'Select group type', 'buddypress' );
	?></label>

	<ul class="categorychecklist form-no-clear">
		<?php foreach ( $types as $type ) : ?>
			<li>
				<label class="selectit"><input value="<?php echo esc_attr( $type->name ) ?>" name="bp-groups-group-type[]" type="checkbox" <?php checked( true, in_array( $type->name, $current_types ) ); ?>>
					<?php
						echo esc_html( $type->labels['singular_name'] );
						if ( in_array( $type->name, $backend_only ) ) {
							printf( ' <span class="description">%s</span>', esc_html__( '(Not available on the front end)', 'buddypress' ) );
						}
					?>

				</label>
			</li>

		<?php endforeach; ?>

	</ul>

	<?php

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


Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.