BP_Members_Admin::user_admin_member_type_metabox( WP_User|null $user = null )

Render the profile type metabox.

Description

Parameters

$user

(WP_User|null) (Optional) The WP_User object to be edited.

Default value: null

Source

File: bp-members/classes/class-bp-members-admin.php

	public function user_admin_member_type_metabox( $user = null ) {

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

		$types = bp_get_member_types( array(), 'objects' );
		$current_type = bp_get_member_type( $user->ID );
		?>

		<label for="bp-members-profile-member-type" class="screen-reader-text"><?php
			/* translators: accessibility text */
			esc_html_e( 'Select profile type', 'buddyboss' );
		?></label>
		<select name="bp-members-profile-member-type" id="bp-members-profile-member-type">
			<option value="" <?php selected( '', $current_type ); ?>><?php
				/* translators: no option picked in select box */
				esc_attr_e( '----', 'buddyboss' );
			?></option>
			<?php foreach ( $types as $type ) : ?>
				<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option>
			<?php endforeach; ?>
		</select>

		<?php

		wp_nonce_field( 'bp-member-type-change-' . $user->ID, 'bp-member-type-nonce' );
	}

Changelog

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