Make WordPress Core

Changeset 41027


Ignore:
Timestamp:
07/11/2017 01:29:51 PM (7 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r40974 r41027  
    425425            if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
    426426                $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
     427
     428            // Add a link to the user's author archive, if not empty.
     429            if ( $author_posts_url = get_author_posts_url( $user_object->ID ) ) {
     430                $actions['view'] = sprintf(
     431                    '<a href="%s" aria-label="%s">%s</a>',
     432                    esc_url( $author_posts_url ),
     433                    /* translators: %s: author's display name */
     434                    esc_attr( sprintf( __( 'View posts by %s' ), $user_object->display_name ) ),
     435                    __( 'View' )
     436                );
     437            }
    427438
    428439            /**
Note: See TracChangeset for help on using the changeset viewer.