WP_MS_Users_List_Table::column_username( WP_User $user )
- Since
- 4.3.0
- Source
wp-admin/includes/class-wp-ms-users-list-table.php:268
Handles the username column output.
Parameters
$userWP_User- The current WP_User object.
Uses · 8
- get_super_admins()Retrieves a list of super admins.
- get_avatar()Retrieves the avatar `` tag for a user, email address, MD5 hash, comment, or post.
- current_user_can()Returns whether the current user has the specified capability.
- esc_url()Checks and cleans a URL.
- add_query_arg()Retrieves a modified URL query string.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- get_edit_user_link()Retrieves the edit user link.
- __()Retrieves the translation of $text.
Source
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 ' — ' . __( 'Super Admin' ); } ?> </strong> <?php }History
Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-admin/includes/class-wp-ms-users-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.