From 1c017250b7ab3bcf3ad19da4aaf46839261d5dc6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 11 Jul 2017 13:29:51 +0000 Subject: [PATCH] Users: Add a "View" link to users listed on the Users screen that points to the user's author archive. Props ryanplas, johnjamesjacoby, viralsampat, Girishpanchal, xkon. Fixes #38085. git-svn-id: https://develop.svn.wordpress.org/trunk@41027 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-users-list-table.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php index 8aecc13855..f557c2b459 100644 --- a/src/wp-admin/includes/class-wp-users-list-table.php +++ b/src/wp-admin/includes/class-wp-users-list-table.php @@ -425,6 +425,17 @@ class WP_Users_List_Table extends WP_List_Table { if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) $actions['remove'] = "" . __( 'Remove' ) . ""; + // Add a link to the user's author archive, if not empty. + if ( $author_posts_url = get_author_posts_url( $user_object->ID ) ) { + $actions['view'] = sprintf( + '%s', + esc_url( $author_posts_url ), + /* translators: %s: author's display name */ + esc_attr( sprintf( __( 'View posts by %s' ), $user_object->display_name ) ), + __( 'View' ) + ); + } + /** * Filters the action links displayed under each user in the Users list table. *