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

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


Parameters Parameters

$which

(string) (Optional) Where this dropdown is displayed

  • top or bottom.

Default value: 'top'


Source 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 member type to&hellip;', 'buddypress' ) ?></label>
		<select name="<?php echo $id_name; ?>" id="<?php echo $id_name; ?>" style="display:inline-block;float:none;">
			<option value=""><?php _e( 'Change member type to&hellip;', 'buddypress' ) ?></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 Member Type', 'buddypress' ) ?></option>

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


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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