Index: src/wp-admin/includes/class-wp-comments-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-comments-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-comments-list-table.php (working copy)
@@ -323,6 +323,18 @@
);
}
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'comment';
+ }
+
public function display() {
wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
@@ -375,69 +387,42 @@
echo "\n";
}
- public function column_cb( $comment ) {
- if ( $this->user_can ) { ?>
-
-
- user_can) {
+ return;
}
- }
- public function column_comment( $comment ) {
- global $comment_status;
$post = get_post();
- $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
$the_comment_status = wp_get_comment_status( $comment->comment_ID );
- echo '
';
+ if( $primary === $column_name ) {
+ $del_nonce = esc_html('_wpnonce=' . wp_create_nonce("delete-comment_$comment->comment_ID"));
+ $approve_nonce = esc_html('_wpnonce=' . wp_create_nonce("approve-comment_$comment->comment_ID"));
- echo '';
- foreach ( $actions as $action => $link ) {
+ foreach ($actions as $action => $link) {
++$i;
- ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
+ ((('approve' == $action || 'unapprove' == $action) && 2 === $i) || 1 === $i) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span when not added with ajax
- if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
+ if (('reply' == $action || 'quickedit' == $action) && !defined('DOING_AJAX'))
$action .= ' hide-if-no-js';
- elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
- if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
+ elseif (($action == 'untrash' && $the_comment_status == 'trash') || ($action == 'unspam' && $the_comment_status == 'spam')) {
+ if ('1' == get_comment_meta($comment->comment_ID, '_wp_trash_meta_status', true))
$action .= ' approve';
else
$action .= ' unapprove';
@@ -512,6 +498,57 @@
}
}
+ public function column_cb( $comment ) {
+ if ( $this->user_can ) { ?>
+
+
+ comment_ID ) );
+ $the_comment_status = wp_get_comment_status( $comment->comment_ID );
+
+ echo '';
+
+ echo '
';
+ /* translators: 2: comment date, 3: comment time */
+ printf( __( 'Submitted on
%2$s at %3$s' ), $comment_url,
+ /* translators: comment date format. See http://php.net/date */
+ get_comment_date( __( 'Y/m/d' ) ),
+ get_comment_date( get_option( 'time_format' ) )
+ );
+
+ if ( $comment->comment_parent ) {
+ $parent = get_comment( $comment->comment_parent );
+ $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+ $name = get_comment_author( $parent->comment_ID );
+ printf( ' | '.__( 'In reply to
%2$s.' ), $parent_link, $name );
+ }
+
+ echo '
';
+ comment_text();
+ if ( $this->user_can ) { ?>
+
+ get_columns();
+ $default = $this->get_default_primary_column_name();
+ /**
+ * Filter the name of the primary column for the current list table.
+ *
+ * @since 4.3
+ *
+ * @param string $default Column name default for the specific list table (eg: 'name')
+ * @param string $context Screen ID for specific list table (eg: 'plugins')
+ */
+ $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
+
+ if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
+ $column = $default;
+ }
+
+ return $column;
+ }
+
+ /**
* Get a list of all, hidden and sortable columns, with filter applied
*
* @since 3.1.0
@@ -831,7 +871,8 @@
$sortable[$id] = $data;
}
- $this->_column_headers = array( $columns, $hidden, $sortable );
+ $primary = $this->get_primary_column_name();
+ $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
return $this->_column_headers;
}
@@ -1059,16 +1100,20 @@
* @param object $item The current item
*/
protected function single_row_columns( $item ) {
- list( $columns, $hidden ) = $this->get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class='$column_name column-$column_name'";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
- $attributes = "$class$style";
+ $attributes = "class='$classes'$style";
if ( 'cb' == $column_name ) {
echo '
';
@@ -1078,6 +1123,7 @@
elseif ( method_exists( $this, 'column_' . $column_name ) ) {
echo " | ";
echo call_user_func( array( $this, 'column_' . $column_name ), $item );
+ echo $this->handle_row_actions( $item, $column_name, $primary );
echo " | ";
}
else {
@@ -1089,6 +1135,22 @@
}
/**
+ * Generate and display row actions links
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @param object $item Item being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $item, $column_name, $primary ) {
+ return '';
+ }
+
+ /**
* Handle an incoming ajax request (called from admin-ajax.php)
*
* @since 3.1.0
Index: src/wp-admin/includes/class-wp-media-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-media-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-media-list-table.php (working copy)
@@ -288,15 +288,20 @@
get_column_info();
+list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
+
foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class='$column_name column-$column_name'";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
- $attributes = $class . $style;
+ $attributes = "class='$classes'$style";
switch ( $column_name ) {
@@ -345,7 +350,9 @@
_media_states( $post ); ?>
guid ); ?>
row_actions( $this->_get_row_actions( $post, $att_title ) );
+ if( $primary === $column_name ) {
+ echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
?>
get_the_author_meta('ID') ), 'upload.php' ) ),
get_the_author()
);
+
+ if( $primary === $column_name ) {
+ echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
?>
- >post_excerpt : ''; ?> |
+ >post_excerpt : ''; ?>
row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
+ echo ' | ';
break;
case 'date':
@@ -384,8 +399,12 @@
}
}
?>
- > |
+ >
row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
+ echo ' | ';
break;
case 'parent':
@@ -414,9 +433,7 @@
'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
), 'upload.php' ); ?>
-
-
-
>
@@ -425,9 +442,13 @@
onclick="findPosts.open( 'media[]','ID ?>' ); return false;"
href="#the-list">
- |
-row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
+ echo '';
break;
case 'comments':
@@ -474,6 +495,9 @@
} else {
echo '—';
}
+ if( $primary === $column_name ) {
+ echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
echo '';
break;
}
@@ -490,6 +514,10 @@
* @param int $post_id Attachment ID.
*/
do_action( 'manage_media_custom_column', $column_name, $post->ID );
+
+ if( $primary === $column_name ) {
+ echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
?>
domain, '', $blog['domain'] ) : $blog['path'];
- list( $columns, $hidden ) = $this->get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
+
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
+ $attributes = "class='$classes'$style";
+
switch ( $column_name ) {
case 'cb': ?>
@@ -260,67 +268,16 @@
break;
case 'blogname':
- echo " | "; ?>
-
- ' . sprintf( __( '%1$s – %2$s' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '';
- restore_current_blog();
- }
-
- // Preordered.
- $actions = array(
- 'edit' => '', 'backend' => '',
- 'activate' => '', 'deactivate' => '',
- 'archive' => '', 'unarchive' => '',
- 'spam' => '', 'unspam' => '',
- 'delete' => '',
- 'visit' => '',
- );
-
- $actions['edit'] = '' . __( 'Edit' ) . '';
- $actions['backend'] = "" . __( 'Dashboard' ) . '';
- if ( get_current_site()->blog_id != $blog['blog_id'] ) {
- if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
- $actions['activate'] = '' . __( 'Activate' ) . '';
- else
- $actions['deactivate'] = '' . __( 'Deactivate' ) . '';
-
- if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
- $actions['unarchive'] = '' . __( 'Unarchive' ) . '';
- else
- $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . '';
-
- if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
- $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . '';
- else
- $actions['spam'] = '' . _x( 'Spam', 'site' ) . '';
-
- if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
- $actions['delete'] = '' . __( 'Delete' ) . '';
- }
-
- $actions['visit'] = "" . __( 'Visit' ) . '';
-
- /**
- * Filter the action links displayed for each site in the Sites list table.
- *
- * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
- * default for each site. The site's status determines whether to show the
- * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
- * 'Not Spam' or 'Spam' link for each site.
- *
- * @since 3.1.0
- *
- * @param array $actions An array of action links to be displayed.
- * @param int $blog_id The site ID.
- * @param string $blogname Site path, formatted depending on whether it is a sub-domain
- * or subdirectory multisite install.
- */
- $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
- echo $this->row_actions( $actions );
+ echo " | "; ?>
+
+ ' . sprintf( __( '%1$s – %2$s' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '';
+ restore_current_blog();
+ }
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
?>
|
";
- echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
+ echo "";
+ echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
+ ?>
|
";
+ echo "";
if ( $blog['registered'] == '0000-00-00 00:00:00' )
echo '—';
else
echo mysql2date( $date, $blog['registered'] );
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
?>
|
";
+ echo "";
$blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) );
if ( is_array( $blogusers ) ) {
$blogusers_warning = '';
@@ -360,6 +320,8 @@
if ( $blogusers_warning != '' )
echo '' . $blogusers_warning . ' ';
}
+
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
?>
|
";
+ echo "";
/**
* Fires inside the auxiliary 'Actions' column of the Sites list table.
*
@@ -377,13 +339,16 @@
*
* @param int $blog_id The site ID.
*/
- do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
+ do_action( 'wpmublogsaction', $blog['blog_id'] );
+
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
+ ?>
|
";
+ echo "";
/**
* Fires for each registered custom column in the Sites list table.
*
@@ -393,6 +358,8 @@
* @param int $blog_id The site ID.
*/
do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
+
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
echo " | ";
break;
}
@@ -402,4 +369,88 @@
domain, '', $blog['domain'] ) : $blog['path'];
+
+ // Preordered.
+ $actions = array(
+ 'edit' => '', 'backend' => '',
+ 'activate' => '', 'deactivate' => '',
+ 'archive' => '', 'unarchive' => '',
+ 'spam' => '', 'unspam' => '',
+ 'delete' => '',
+ 'visit' => '',
+ );
+
+ $actions['edit'] = '' . __('Edit') . '';
+ $actions['backend'] = "" . __('Dashboard') . '';
+ if (get_current_site()->blog_id != $blog['blog_id']) {
+ if (get_blog_status($blog['blog_id'], 'deleted') == '1')
+ $actions['activate'] = '' . __('Activate') . '';
+ else
+ $actions['deactivate'] = '' . __('Deactivate') . '';
+
+ if (get_blog_status($blog['blog_id'], 'archived') == '1')
+ $actions['unarchive'] = '' . __('Unarchive') . '';
+ else
+ $actions['archive'] = '' . _x('Archive', 'verb; site') . '';
+
+ if (get_blog_status($blog['blog_id'], 'spam') == '1')
+ $actions['unspam'] = '' . _x('Not Spam', 'site') . '';
+ else
+ $actions['spam'] = '' . _x('Spam', 'site') . '';
+
+ if (current_user_can('delete_site', $blog['blog_id']))
+ $actions['delete'] = '' . __('Delete') . '';
+ }
+
+ $actions['visit'] = "" . __('Visit') . '';
+
+ /**
+ * Filter the action links displayed for each site in the Sites list table.
+ *
+ * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
+ * default for each site. The site's status determines whether to show the
+ * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
+ * 'Not Spam' or 'Spam' link for each site.
+ *
+ * @since 3.1.0
+ *
+ * @param array $actions An array of action links to be displayed.
+ * @param int $blog_id The site ID.
+ * @param string $blogname Site path, formatted depending on whether it is a sub-domain
+ * or subdirectory multisite install.
+ */
+ $actions = apply_filters('manage_sites_action_links', array_filter($actions), $blog['blog_id'], $blogname);
+ return $this->row_actions($actions);
+ }
+ }
}
Index: src/wp-admin/includes/class-wp-ms-themes-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-ms-themes-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-ms-themes-list-table.php (working copy)
@@ -215,6 +215,18 @@
);
}
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'name';
+ }
+
protected function get_views() {
global $totals, $status;
@@ -375,7 +387,7 @@
echo "
";
- list( $columns, $hidden ) = $this->get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$style = '';
@@ -388,7 +400,9 @@
break;
case 'name':
echo "" . $theme->display('Name') . "";
- echo $this->row_actions( $actions, true );
+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
echo " | ";
break;
case 'description':
@@ -426,7 +440,11 @@
$theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
echo implode( ' | ', $theme_meta );
- echo "";
+ echo '';
+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
+ echo '';
break;
default:
@@ -442,6 +460,10 @@
* @param WP_Theme $theme Current WP_Theme object.
*/
do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
+
+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
echo "";
}
}
Index: src/wp-admin/includes/class-wp-ms-users-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-ms-users-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-ms-users-list-table.php (working copy)
@@ -164,16 +164,20 @@
get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) :
- $class = "class='$column_name column-$column_name'";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
- $attributes = "$class$style";
+ $attributes = "class='$classes'$style";
switch ( $column_name ) {
case 'cb': ?>
@@ -193,38 +197,15 @@
if ( in_array( $user->user_login, $super_admins ) )
echo ' - ' . __( 'Super Admin' );
?>
-
- ' . __( 'Edit' ) . '';
-
- if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
- $actions['delete'] = '' . __( 'Delete' ) . '';
- }
-
- /**
- * Filter the action links displayed under each user
- * in the Network Admin Users list table.
- *
- * @since 3.2.0
- *
- * @param array $actions An array of action links to be displayed.
- * Default 'Edit', 'Delete'.
- * @param WP_User $user WP_User object.
- */
- $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
- echo $this->row_actions( $actions );
- ?>
-
$user->first_name $user->last_name";
+ echo "$user->first_name $user->last_name";
break;
case 'email':
- echo " | $user->user_email | ";
+ echo "$user->user_email";
break;
case 'registered':
@@ -233,7 +214,7 @@
else
$date = __( 'Y/m/d g:i:s a' );
- echo " | " . mysql2date( $date, $user->user_registered ) . " | ";
+ echo "" . mysql2date( $date, $user->user_registered );
break;
case 'blogs':
@@ -286,7 +267,6 @@
}
}
?>
- |
";
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
- echo "";
break;
}
+
+ echo $this->handle_row_actions( $user, $column_name, $primary );
+ echo '';
endforeach
?>
@@ -303,4 +285,55 @@
ID ) ) );
+
+ if ( $primary === $column_name ) {
+ $actions = array();
+ $actions['edit'] = '
' . __( 'Edit' ) . '';
+
+ if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
+ $actions['delete'] = '
' . __( 'Delete' ) . '';
+ }
+
+ /**
+ * Filter the action links displayed under each user
+ * in the Network Admin Users list table.
+ *
+ * @since 3.2.0
+ *
+ * @param array $actions An array of action links to be displayed.
+ * Default 'Edit', 'Delete'.
+ * @param WP_User $user WP_User object.
+ */
+ $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
+ return $this->row_actions( $actions );
+ }
+ }
}
Index: src/wp-admin/includes/class-wp-plugins-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-plugins-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-plugins-list-table.php (working copy)
@@ -301,7 +301,7 @@
add_query_arg('plugin_status', $type, 'plugins.php'),
( $type == $status ) ? ' class="current"' : '',
sprintf( $text, number_format_i18n( $count ) )
- );
+ );
}
}
@@ -451,7 +451,7 @@
$actions['delete'] = '
' . __('Delete') . '';
} // end if $is_active
- } // end if $screen->in_admin( 'network' )
+ } // end if $screen->in_admin( 'network' )
if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
$actions['edit'] = '
' . __('Edit') . '';
@@ -531,12 +531,15 @@
$plugin_slug
);
- list( $columns, $hidden ) = $this->get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
+ $extra_class = ' has-row-actions';
+
foreach ( $columns as $column_name => $column_display_name ) {
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
switch ( $column_name ) {
case 'cb':
@@ -543,12 +546,21 @@
echo "
$checkbox | ";
break;
case 'name':
- echo "
$plugin_name";
- echo $this->row_actions( $actions, true );
+ if ( $primary === $column_name || ! isset( $columns[ $primary ] ) ) {
+ echo " | $plugin_name";
+ }
echo " | ";
break;
case 'description':
- echo "
+ $classes = 'column-description desc';
+ if ( $primary === $column_name ) {
+ $classes .= " $extra_class";
+ }
+
+ echo " |
$description
";
@@ -595,11 +607,19 @@
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
echo implode( ' | ', $plugin_meta );
+ if ( $primary === $column_name ) {
+ echo $this->row_actions( $actions, true );
+ }
echo " | ";
break;
default:
- echo "
";
+ $classes = "$column_name column-$column_name$class";
+ if ( $primary === $column_name ) {
+ $classes .= " $extra_class";
+ }
+ echo " | ";
+
/**
* Fires inside each custom column of the Plugins list table.
*
@@ -610,6 +630,10 @@
* @param array $plugin_data An array of plugin data.
*/
do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
+
+ if ( $primary === $column_name ) {
+ echo $this->row_actions( $actions, true );
+ }
echo " | ";
}
}
@@ -645,4 +669,16 @@
*/
do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
}
-}
+
+ /**
+ * Get name of default primary column for this specific list table.
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'desc';
+ }
+}
\ No newline at end of file
Index: src/wp-admin/includes/class-wp-posts-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-posts-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-posts-list-table.php (working copy)
@@ -665,16 +665,20 @@
get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
- $attributes = "$class$style";
+ $attributes = "class='$classes'$style";
switch ( $column_name ) {
@@ -696,7 +700,8 @@
break;
case 'title':
- $attributes = 'class="post-title page-title column-title"' . $style;
+ $classes .= ' page-title'; // Special addition for title column
+ $attributes = "class='$classes'$style";
if ( $this->hierarchical_display ) {
if ( 0 == $level && (int) $post->post_parent > 0 ) {
// Sent level 0 by accident, by default, or because we don't know the actual level.
@@ -753,66 +758,8 @@
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
the_excerpt();
- $actions = array();
- if ( $can_edit_post && 'trash' != $post->post_status ) {
- $actions['edit'] = '' . __( 'Edit' ) . '';
- $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . '';
- }
- if ( current_user_can( 'delete_post', $post->ID ) ) {
- if ( 'trash' == $post->post_status )
- $actions['untrash'] = "ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "";
- elseif ( EMPTY_TRASH_DAYS )
- $actions['trash'] = "" . __( 'Trash' ) . "";
- if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "" . __( 'Delete Permanently' ) . "";
- }
- if ( $post_type_object->public ) {
- if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
- if ( $can_edit_post ) {
- $preview_link = set_url_scheme( get_permalink( $post->ID ) );
- /** This filter is documented in wp-admin/includes/meta-boxes.php */
- $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
- $actions['view'] = '' . __( 'Preview' ) . '';
- }
- } elseif ( 'trash' != $post->post_status ) {
- $actions['view'] = '' . __( 'View' ) . '';
- }
- }
+ echo $this->handle_row_actions( $post, $column_name, $primary );
- if ( is_post_type_hierarchical( $post->post_type ) ) {
-
- /**
- * Filter the array of row action links on the Pages list table.
- *
- * The filter is evaluated only for hierarchical post types.
- *
- * @since 2.8.0
- *
- * @param array $actions An array of row action links. Defaults are
- * 'Edit', 'Quick Edit', 'Restore, 'Trash',
- * 'Delete Permanently', 'Preview', and 'View'.
- * @param WP_Post $post The post object.
- */
- $actions = apply_filters( 'page_row_actions', $actions, $post );
- } else {
-
- /**
- * Filter the array of row action links on the Posts list table.
- *
- * The filter is evaluated only for non-hierarchical post types.
- *
- * @since 2.8.0
- *
- * @param array $actions An array of row action links. Defaults are
- * 'Edit', 'Quick Edit', 'Restore, 'Trash',
- * 'Delete Permanently', 'Preview', and 'View'.
- * @param WP_Post $post The post object.
- */
- $actions = apply_filters( 'post_row_actions', $actions, $post );
- }
-
- echo $this->row_actions( $actions );
-
get_inline_data( $post );
echo '';
break;
@@ -868,6 +815,7 @@
} else {
_e( 'Last Modified' );
}
+ echo $this->handle_row_actions( $post, $column_name, $primary );
echo '';
break;
@@ -879,7 +827,7 @@
$this->comments_bubble( $post->ID, $pending_comments );
?>
-
+ handle_row_actions( $post, $column_name, $primary ); ?>
$post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
get_the_author()
);
+ echo $this->handle_row_actions( $post, $column_name, $primary );
?>
handle_row_actions( $post, $column_name, $primary );
echo '';
break;
}
@@ -976,6 +926,7 @@
* @param int $post_id The current post ID.
*/
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
+ echo $this->handle_row_actions( $post, $column_name, $primary );
?>
post_type );
+ $can_edit_post = current_user_can( 'edit_post', $post->ID );
+ $actions = array();
+
+ if ($can_edit_post && 'trash' != $post->post_status) {
+ $actions['edit'] = '' . __('Edit') . '';
+ $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . '';
+ }
+
+ if (current_user_can('delete_post', $post->ID)) {
+ if ('trash' == $post->post_status)
+ $actions['untrash'] = "ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "";
+ elseif (EMPTY_TRASH_DAYS)
+ $actions['trash'] = "" . __('Trash') . "";
+ if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS)
+ $actions['delete'] = "" . __('Delete Permanently') . "";
+ }
+
+ if ($post_type_object->public) {
+ if (in_array($post->post_status, array('pending', 'draft', 'future'))) {
+ if ($can_edit_post) {
+ $preview_link = set_url_scheme(get_permalink($post->ID));
+ /** This filter is documented in wp-admin/includes/meta-boxes.php */
+ $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
+ $actions['view'] = '' . __('Preview') . '';
+ }
+ } elseif ('trash' != $post->post_status) {
+ $actions['view'] = '' . __('View') . '';
+ }
+ }
+
+ if (is_post_type_hierarchical($post->post_type)) {
+
+ /**
+ * Filter the array of row action links on the Pages list table.
+ *
+ * The filter is evaluated only for hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters('page_row_actions', $actions, $post);
+ } else {
+
+ /**
+ * Filter the array of row action links on the Posts list table.
+ *
+ * The filter is evaluated only for non-hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters('post_row_actions', $actions, $post);
+ }
+
+ return $this->row_actions($actions);
+ }
+ }
+
+ /**
* Outputs the hidden row displayed when inline editing
*
* @since 3.1.0
Index: src/wp-admin/includes/class-wp-terms-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-terms-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-terms-list-table.php (working copy)
@@ -302,10 +302,7 @@
*/
public function column_name( $tag ) {
$taxonomy = $this->screen->taxonomy;
- $tax = get_taxonomy( $taxonomy );
- $default_term = get_option( 'default_' . $taxonomy );
-
$pad = str_repeat( '— ', max( 0, $this->level ) );
/**
@@ -328,42 +325,6 @@
$out = '' . $name . '
';
- $actions = array();
- if ( current_user_can( $tax->cap->edit_terms ) ) {
- $actions['edit'] = '' . __( 'Edit' ) . '';
- $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . '';
- }
- if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
- $actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . "";
- if ( $tax->public )
- $actions['view'] = '' . __( 'View' ) . '';
-
- /**
- * Filter the action links displayed for each term in the Tags list table.
- *
- * @since 2.8.0
- * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
- *
- * @param array $actions An array of action links to be displayed. Default
- * 'Edit', 'Quick Edit', 'Delete', and 'View'.
- * @param object $tag Term object.
- */
- $actions = apply_filters( 'tag_row_actions', $actions, $tag );
-
- /**
- * Filter the action links displayed for each term in the terms list table.
- *
- * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
- *
- * @since 3.0.0
- *
- * @param array $actions An array of action links to be displayed. Default
- * 'Edit', 'Quick Edit', 'Delete', and 'View'.
- * @param object $tag Term object.
- */
- $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
-
- $out .= $this->row_actions( $actions );
$out .= '';
$out .= '
' . $qe_data->name . '
';
@@ -375,6 +336,77 @@
}
/**
+ * Get name of default primary column
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'name';
+ }
+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @param object $tag Tag being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $tag, $column_name, $primary ) {
+ $taxonomy = $this->screen->taxonomy;
+ $tax = get_taxonomy( $taxonomy );
+ $default_term = get_option( 'default_' . $taxonomy );
+
+ $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
+
+ if ( $primary === $column_name ) {
+ $actions = array();
+ if ( current_user_can( $tax->cap->edit_terms ) ) {
+ $actions['edit'] = '
' . __( 'Edit' ) . '';
+ $actions['inline hide-if-no-js'] = '
' . __( 'Quick Edit' ) . '';
+ }
+ if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
+ $actions['delete'] = "
term_id ) . "'>" . __( 'Delete' ) . "";
+ if ( $tax->public )
+ $actions['view'] = '
' . __( 'View' ) . '';
+
+ /**
+ * Filter the action links displayed for each term in the Tags list table.
+ *
+ * @since 2.8.0
+ * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
+ *
+ * @param array $actions An array of action links to be displayed. Default
+ * 'Edit', 'Quick Edit', 'Delete', and 'View'.
+ * @param object $tag Term object.
+ */
+ $actions = apply_filters( 'tag_row_actions', $actions, $tag );
+
+ /**
+ * Filter the action links displayed for each term in the terms list table.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param array $actions An array of action links to be displayed. Default
+ * 'Edit', 'Quick Edit', 'Delete', and 'View'.
+ * @param object $tag Term object.
+ */
+ $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
+
+ return $this->row_actions( $actions );
+ }
+ }
+
+ /**
* @param object $tag
* @return string
*/
Index: src/wp-admin/includes/class-wp-users-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-users-list-table.php (revision 32551)
+++ src/wp-admin/includes/class-wp-users-list-table.php (working copy)
@@ -384,7 +384,6 @@
* @param WP_User $user_object WP_User object for the currently-listed user.
*/
$actions = apply_filters( 'user_row_actions', $actions, $user_object );
- $edit .= $this->row_actions( $actions );
// Set up the checkbox ( because the user is editable, otherwise it's empty )
$checkbox = '
'
@@ -398,16 +397,20 @@
$r = "
";
- list( $columns, $hidden ) = $this->get_column_info();
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
$style = '';
- if ( in_array( $column_name, $hidden ) )
+ if ( in_array( $column_name, $hidden ) ) {
$style = ' style="display:none;"';
+ }
- $attributes = "$class$style";
+ $attributes = "class='$classes'$style";
switch ( $column_name ) {
case 'cb':
@@ -414,16 +417,16 @@
$r .= "$checkbox | ";
break;
case 'username':
- $r .= "$avatar $edit | ";
+ $r .= "$avatar $edit";
break;
case 'name':
- $r .= " | $user_object->first_name $user_object->last_name | ";
+ $r .= "$user_object->first_name $user_object->last_name";
break;
case 'email':
- $r .= " | $email | ";
+ $r .= "$email";
break;
case 'role':
- $r .= " | $role_name | ";
+ $r .= "$role_name";
break;
case 'posts':
$attributes = 'class="posts column-posts num"' . $style;
@@ -435,7 +438,6 @@
} else {
$r .= 0;
}
- $r .= " | ";
break;
default:
$r .= "";
@@ -450,11 +452,27 @@
* @param int $user_id ID of the currently-listed user.
*/
$r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
- $r .= " | ";
}
+
+ if ( $primary === $column_name ) {
+ $r .= $this->row_actions( $actions );
+ }
+ $r .= "";
}
$r .= '
';
return $r;
}
+
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'username';
+ }
}