bp_group_type_labels_meta_box( WP_Post $post )

Generate group Type Label Meta box.

Description

Parameters

$post

(WP_Post) (Required)

Source

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

function bp_group_type_labels_meta_box( $post ) {

	/* Group Type Labels */
	$meta = get_post_custom( $post->ID );
	$label_name = isset( $meta[ '_bp_group_type_label_name' ] ) ? $meta[ '_bp_group_type_label_name' ][ 0 ] : '';
	$label_singular_name = isset( $meta[ '_bp_group_type_label_singular_name' ] ) ? $meta[ '_bp_group_type_label_singular_name' ][ 0 ] : '';
	?>

	<table class="widefat bp-postbox-table">
		<thead>
			<tr>
				<th scope="col" colspan="2">
					<?php _e( 'Group Type', 'buddyboss' ); ?>
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th>
					<?php _e( 'Plural Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" class="bp-group-type-label-name" name="bp-group-type[label_name]" placeholder="<?php _e( 'e.g. Teams', 'buddyboss' ); ?>"  value="<?php echo esc_attr( $label_name ); ?>" style="width: 100%" />
				</td>
			</tr>
			<tr>
				<th>
					<?php _e( 'Singular Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" class="bp-group-type-singular-name" name="bp-group-type[label_singular_name]" placeholder="<?php _e( 'e.g. Team', 'buddyboss' ); ?>" value="<?php echo esc_attr( $label_singular_name ); ?>" style="width: 100%" />
				</td>
			</tr>
		</tbody>
	</table>
	<?php wp_nonce_field( 'bp-group-type-edit-group-type', '_bp-group-type-nonce' ); ?>

	<?php
	/* Group Role Labels */
	$group_type_roles   = get_post_meta( $post->ID, '_bp_group_type_role_labels', true ) ?: [];
	$organizer_plural   = ( isset( $group_type_roles['organizer_plural_label_name'] ) && $group_type_roles['organizer_plural_label_name'] ) ? $group_type_roles['organizer_plural_label_name'] : '';
	$moderator_plural   = ( isset( $group_type_roles['moderator_plural_label_name'] ) && $group_type_roles['moderator_plural_label_name'] ) ? $group_type_roles['moderator_plural_label_name'] : '';
	$members_plural     = ( isset( $group_type_roles['member_plural_label_name'] ) && $group_type_roles['member_plural_label_name'] ) ? $group_type_roles['member_plural_label_name'] : '';
	$organizer_singular = ( isset( $group_type_roles['organizer_singular_label_name'] ) && $group_type_roles['organizer_singular_label_name'] ) ? $group_type_roles['organizer_singular_label_name'] : '';
	$moderator_singular = ( isset( $group_type_roles['moderator_singular_label_name'] ) && $group_type_roles['moderator_singular_label_name'] ) ? $group_type_roles['moderator_singular_label_name'] : '';
	$members_singular   = ( isset( $group_type_roles['member_singular_label_name'] ) && $group_type_roles['member_singular_label_name'] ) ? $group_type_roles['member_singular_label_name'] : '';
	?>

	<br />

	<h3><?php _e( 'Group Roles', 'buddyboss' ); ?></h3>
	<p><?php _e( 'Rename the group member roles for groups of this type (optional).', 'buddyboss' ); ?></p>

	<table class="widefat bp-postbox-table">
		<thead>
			<tr>
				<th scope="col" colspan="2">
					<?php _e( 'Organizers', 'buddyboss' ); ?>
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th>
					<?php _e( 'Plural Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[organizer_plural_label_name]" placeholder="<?php _e( 'e.g. Organizers', 'buddyboss' ); ?>"  value="<?php echo esc_attr( $organizer_plural ); ?>" style="width: 100%;" />
				</td>
			</tr>
			<tr>
				<th>
					<?php _e( 'Singular Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[organizer_singular_label_name]" placeholder="<?php _e( 'e.g. Organizer', 'buddyboss' ); ?>" value="<?php echo esc_attr( $organizer_singular ); ?>" style="width: 100%;" />
				</td>
			</tr>
		</tbody>
	</table>

	<table class="widefat bp-postbox-table">
		<thead>
			<tr>
				<th scope="col" colspan="2">
					<?php _e( 'Moderators', 'buddyboss' ); ?>
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th>
					<?php _e( 'Plural Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[moderator_plural_label_name]" placeholder="<?php _e( 'e.g. Moderators', 'buddyboss' ); ?>"  value="<?php echo esc_attr( $moderator_plural ); ?>" style="width: 100%;" />
				</td>
			</tr>
			<tr>
				<th>
					<?php _e( 'Singular Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[moderator_singular_label_name]" placeholder="<?php _e( 'e.g. Moderator', 'buddyboss' ); ?>" value="<?php echo esc_attr( $moderator_singular ); ?>" style="width: 100%;" />
				</td>
			</tr>
		</tbody>
	</table>

	<table class="widefat bp-postbox-table">
		<thead>
			<tr>
				<th scope="col" colspan="2">
					<?php _e( 'Members', 'buddyboss' ); ?>
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th>
					<?php _e( 'Plural Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[member_plural_label_name]" placeholder="<?php _e( 'e.g. Members', 'buddyboss' ); ?>"  value="<?php echo esc_attr( $members_plural ); ?>" style="width: 100%;" />
				</td>
			</tr>
			<tr>
				<th>
					<?php _e( 'Singular Label', 'buddyboss' ); ?>
				</th>
				<td>
					<input type="text" name="bp-group-type-role[member_singular_label_name]" placeholder="<?php _e( 'e.g. Member', 'buddyboss' ); ?>" value="<?php echo esc_attr( $members_singular ); ?>" style="width: 100%;" />
				</td>
			</tr>
		</tbody>
	</table>

	<?php

}

Changelog

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.