- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array( $column_name, $hidden ) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ( $column_name ) {
- case 'cb':
- $r .= "<th scope='row' class='check-column'>$checkbox</th>";
- break;
- case 'username':
- $r .= "<td $attributes>$avatar $edit</td>";
- break;
- case 'name':
- $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
- break;
- case 'email':
- $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
- break;
- case 'role':
- $r .= "<td $attributes>$role_name</td>";
- break;
- case 'posts':
- $attributes = 'class="posts column-posts num"' . $style;
- $r .= "<td $attributes>";
- if ( $numposts > 0 ) {
- $r .= "<a href='edit.php?author=$user_object->ID' title='" . esc_attr__( 'View posts by this author' ) . "' class='edit'>";
- $r .= $numposts;
- $r .= '</a>';
- } else {
- $r .= 0;
- }
- $r .= "</td>";
- break;
- default:
- $r .= "<td $attributes>";
- $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
- $r .= "</td>";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
+ if ( 'posts' === $column_name ) {
+ $classes .= ' num'; // Special case for that column
+ }
+
+ if ( in_array( $column_name, $hidden ) ) {
+ $classes .= ' hidden';
+ }
+
+ $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
+
+ $attributes = "class='$classes' $data";
+
+ if ( 'cb' === $column_name ) {
+ $r .= "<th scope='row' class='check-column'>$checkbox</th>";
+ } else {
+ $r .= "<td $attributes>";
+ switch ( $column_name ) {
+ case 'username':
+ $r .= "$avatar $edit";
+ break;
+ case 'name':
+ $r .= "$user_object->first_name $user_object->last_name";
+ break;
+ case 'email':
+ $r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>";
+ break;
+ case 'role':
+ $r .= esc_html( $roles_list );
+ break;
+ case 'posts':
+ if ( $numposts > 0 ) {
+ $r .= "<a href='edit.php?author=$user_object->ID' class='edit'>";
+ $r .= '<span aria-hidden="true">' . $numposts . '</span>';
+ $r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>';
+ $r .= '</a>';
+ } else {
+ $r .= 0;
+ }
+ break;
+ default:
+ /**
+ * Filters the display output of custom columns in the Users list table.
+ *
+ * @since 2.8.0
+ *
+ * @param string $output Custom column output. Default empty.
+ * @param string $column_name Column name.
+ * @param int $user_id ID of the currently-listed user.
+ */
+ $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
+ }
+
+ if ( $primary === $column_name ) {
+ $r .= $this->row_actions( $actions );
+ }
+ $r .= "</td>";