CommentCount.php
4 years ago
Description.php
4 years ago
DisplayName.php
4 years ago
Email.php
4 years ago
FirstName.php
4 years ago
FirstPost.php
4 years ago
FullName.php
4 years ago
ID.php
4 years ago
LastName.php
4 years ago
LastPost.php
4 years ago
Login.php
4 years ago
Name.php
4 years ago
Nicename.php
4 years ago
Nickname.php
4 years ago
PostCount.php
4 years ago
Posts.php
4 years ago
Registered.php
4 years ago
RichEditing.php
4 years ago
Role.php
4 years ago
ShowToolbar.php
4 years ago
Url.php
4 years ago
Username.php
4 years ago
Login.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Column\User; |
| 4 | |
| 5 | use AC\Column; |
| 6 | |
| 7 | class Login extends Column { |
| 8 | |
| 9 | public function __construct() { |
| 10 | $this->set_type( 'column-user_login' ) |
| 11 | ->set_label( __( 'Username', 'codepress-admin-columns' ) ); |
| 12 | } |
| 13 | |
| 14 | public function get_value( $user_id ) { |
| 15 | $user = get_userdata( $user_id ); |
| 16 | |
| 17 | $value = $user->user_login; |
| 18 | |
| 19 | if ( current_user_can( 'edit_user', $user->ID ) ) { |
| 20 | $value = sprintf( '<a href="%s">%s</a>', get_edit_user_link( $user->ID ), $value ); |
| 21 | } |
| 22 | |
| 23 | if ( in_array( $user->user_login, get_super_admins(), true ) ) { |
| 24 | $value .= ' — ' . __( 'Super Admin' ); |
| 25 | } |
| 26 | |
| 27 | return $value; |
| 28 | } |
| 29 | |
| 30 | public function get_raw_value( $user_id ) { |
| 31 | return get_userdata( $user_id )->user_login; |
| 32 | } |
| 33 | |
| 34 | } |