WP_MS_Users_List_Table::column_username()publicWP 4.3.0

Handles the username column output.

Method of the class: WP_MS_Users_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_MS_Users_List_Table = new WP_MS_Users_List_Table();
$WP_MS_Users_List_Table->column_username( $user );
$user(WP_User) (required)
The current WP_User object.

Changelog

Since 4.3.0 Introduced.

WP_MS_Users_List_Table::column_username() code WP 6.6.2

<?php
public function column_username( $user ) {
	$super_admins = get_super_admins();
	$avatar       = get_avatar( $user->user_email, 32 );

	echo $avatar;

	if ( current_user_can( 'edit_user', $user->ID ) ) {
		$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
		$edit      = "<a href=\"{$edit_link}\">{$user->user_login}</a>";
	} else {
		$edit = $user->user_login;
	}

	?>
	<strong>
		<?php
		echo $edit;

		if ( in_array( $user->user_login, $super_admins, true ) ) {
			echo ' &mdash; ' . __( 'Super Admin' );
		}
		?>
	</strong>
	<?php
}