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
Nicename.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Column\User; |
| 4 | |
| 5 | use AC\Column; |
| 6 | |
| 7 | class Nicename extends Column { |
| 8 | |
| 9 | public function __construct() { |
| 10 | $this->set_type( 'column-user_nicename' ) |
| 11 | ->set_label( __( 'Author Slug', 'codepress-admin-columns' ) ); |
| 12 | } |
| 13 | |
| 14 | public function get_value( $user_id ) { |
| 15 | $value = $this->get_raw_value( $user_id ); |
| 16 | |
| 17 | if ( empty( $value ) ) { |
| 18 | return $this->get_empty_char(); |
| 19 | } |
| 20 | |
| 21 | $url = get_author_posts_url( $user_id ); |
| 22 | |
| 23 | if ( $url ) { |
| 24 | $value = sprintf( '<a href="%s">%s</a>', $url, $value ); |
| 25 | } |
| 26 | |
| 27 | return $value; |
| 28 | } |
| 29 | |
| 30 | public function get_raw_value( $user_id ) { |
| 31 | return get_userdata( $user_id )->user_nicename; |
| 32 | } |
| 33 | |
| 34 | } |