BP_Members_Admin::users_table_output_type_change_select( string $which = 'top' )

Display a dropdown to bulk change the profile type of selected user(s).

Description

Parameters

$which

(Optional) Where this dropdown is displayed - top or bottom.

Default value: 'top'

Source

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

	public function users_table_output_type_change_select( $which = 'top' ) {

		// Bail if current user cannot promote users.
		if ( ! bp_current_user_can( 'promote_users' ) ) {
			return;
		}

		// `$which` is only passed in WordPress 4.6+. Avoid duplicating controls in earlier versions.
		static $displayed = false;
		if ( version_compare( bp_get_major_wp_version(), '4.6', '<' ) && $displayed ) {
			return;
		}
		$displayed = true;

		$id_name = 'bottom' === $which ? 'bp_change_type2' : 'bp_change_type';

		$types = bp_get_member_types( array(), 'objects' ); ?>

		<label class="screen-reader-text" for="<?php echo $id_name; ?>"><?php _e( 'Change profile type to&hellip;', 'buddyboss' ) ?></label>
		<select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;">
			<option value=""><?php _e( 'Change profile type to&hellip;', 'buddyboss' ) ?></option>

			<?php foreach( $types as $type ) : ?>

				<option value="<?php echo esc_attr( $type->name ); ?>"><?php echo esc_html( $type->labels['singular_name'] ); ?></option>

			<?php endforeach; ?>

			<option value="remove_member_type"><?php _e( 'No Profile Type', 'buddyboss' ) ?></option>

		</select>
		<?php
		wp_nonce_field( 'bp-bulk-users-change-type-' . bp_loggedin_user_id(), 'bp-bulk-users-change-type-nonce' );
		submit_button( __( 'Change', 'buddyboss' ), 'button', 'bp_change_member_type', false );
	}

Changelog

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