List tables: introduce the concept of a "primary" column.
This becomes the column that contains the row actions, and allows for a more flexibility, particularly with custom post types and list tables. To (re)define the primary column, use the `list_table_primary_column` filter, which receives the column name and the screen ID as arguments. props stephdau, DaveAl, jesin. see #25408. Built from https://develop.svn.wordpress.org/trunk@32644 git-svn-id: http://core.svn.wordpress.org/trunk@32614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
282e28ad81
commit
4c0c7fd7ba
|
@ -357,6 +357,18 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @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' );
|
||||
|
||||
|
@ -415,62 +427,33 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
public function column_cb( $comment ) {
|
||||
if ( $this->user_can ) { ?>
|
||||
<label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
|
||||
<input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
|
||||
<?php
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @param object $comment Comment being acted upon
|
||||
* @param string $column_name Current column name
|
||||
* @param string $primary Primary column name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function handle_row_actions( $comment, $column_name, $primary ) {
|
||||
global $comment_status;
|
||||
|
||||
if ( ! $this->user_can ) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global string $comment_status
|
||||
* @param object $comment
|
||||
*/
|
||||
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 '<div class="comment-author">';
|
||||
$this->column_author( $comment );
|
||||
echo '</div>';
|
||||
$out = '';
|
||||
|
||||
echo '<div class="submitted-on">';
|
||||
/* translators: 2: comment date, 3: comment time */
|
||||
printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $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 <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
comment_text();
|
||||
if ( $this->user_can ) { ?>
|
||||
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
|
||||
<textarea class="comment" rows="1" cols="1"><?php
|
||||
/** This filter is documented in wp-admin/includes/comment.php */
|
||||
echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
|
||||
?></textarea>
|
||||
<div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
|
||||
<div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
|
||||
<div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
|
||||
<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $this->user_can ) {
|
||||
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" ) );
|
||||
|
||||
|
@ -536,7 +519,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
$actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
|
||||
|
||||
$i = 0;
|
||||
echo '<div class="row-actions">';
|
||||
$out .= '<div class="row-actions">';
|
||||
foreach ( $actions as $action => $link ) {
|
||||
++$i;
|
||||
( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
|
||||
|
@ -551,9 +534,67 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
$action .= ' unapprove';
|
||||
}
|
||||
|
||||
echo "<span class='$action'>$sep$link</span>";
|
||||
$out .= "<span class='$action'>$sep$link</span>";
|
||||
}
|
||||
echo '</div>';
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function column_cb( $comment ) {
|
||||
if ( $this->user_can ) { ?>
|
||||
<label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
|
||||
<input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global string $comment_status
|
||||
* @param object $comment
|
||||
*/
|
||||
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 '<div class="comment-author">';
|
||||
$this->column_author( $comment );
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="submitted-on">';
|
||||
/* translators: 2: comment date, 3: comment time */
|
||||
printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $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 <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
comment_text();
|
||||
if ( $this->user_can ) { ?>
|
||||
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
|
||||
<textarea class="comment" rows="1" cols="1"><?php
|
||||
/** This filter is documented in wp-admin/includes/comment.php */
|
||||
echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
|
||||
?></textarea>
|
||||
<div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
|
||||
<div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
|
||||
<div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
|
||||
<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,18 @@ class WP_Links_List_Table extends WP_List_Table {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global int $cat_id
|
||||
|
@ -142,66 +154,61 @@ class WP_Links_List_Table extends WP_List_Table {
|
|||
<tr id="link-<?php echo $link->link_id; ?>">
|
||||
<?php
|
||||
|
||||
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-$column_name'";
|
||||
$classes = "$column_name column-$column_name";
|
||||
if ( $primary === $column_name ) {
|
||||
$classes .= ' has-row-actions column-primary';
|
||||
}
|
||||
|
||||
$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': ?>
|
||||
<th scope="row" class="check-column">
|
||||
<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
|
||||
<input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
if ( 'cb' === $column_name ) {
|
||||
?>
|
||||
<th scope="row" class="check-column">
|
||||
<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
|
||||
<input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
|
||||
</th>
|
||||
<?php
|
||||
} else {
|
||||
echo "<td $attributes>";
|
||||
|
||||
case 'name':
|
||||
echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
|
||||
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . "</a>";
|
||||
echo $this->row_actions( $actions );
|
||||
|
||||
echo '</td>';
|
||||
break;
|
||||
case 'url':
|
||||
echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a></td>";
|
||||
break;
|
||||
case 'categories':
|
||||
?><td <?php echo $attributes ?>><?php
|
||||
$cat_names = array();
|
||||
foreach ( $link->link_category as $category ) {
|
||||
$cat = get_term( $category, 'link_category', OBJECT, 'display' );
|
||||
if ( is_wp_error( $cat ) )
|
||||
echo $cat->get_error_message();
|
||||
$cat_name = $cat->name;
|
||||
if ( $cat_id != $category )
|
||||
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
|
||||
$cat_names[] = $cat_name;
|
||||
}
|
||||
echo implode( ', ', $cat_names );
|
||||
?></td><?php
|
||||
break;
|
||||
case 'rel':
|
||||
?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; ?></td><?php
|
||||
break;
|
||||
case 'visible':
|
||||
?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
|
||||
break;
|
||||
case 'rating':
|
||||
?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
switch ( $column_name ) {
|
||||
case 'name':
|
||||
echo "<strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
|
||||
break;
|
||||
case 'url':
|
||||
echo "<a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a>";
|
||||
break;
|
||||
case 'categories':
|
||||
$cat_names = array();
|
||||
foreach ( $link->link_category as $category ) {
|
||||
$cat = get_term( $category, 'link_category', OBJECT, 'display' );
|
||||
if ( is_wp_error( $cat ) )
|
||||
echo $cat->get_error_message();
|
||||
$cat_name = $cat->name;
|
||||
if ( $cat_id != $category )
|
||||
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
|
||||
$cat_names[] = $cat_name;
|
||||
}
|
||||
echo implode( ', ', $cat_names );
|
||||
break;
|
||||
case 'rel':
|
||||
echo empty( $link->link_rel ) ? '<br />' : $link->link_rel;
|
||||
break;
|
||||
case 'visible':
|
||||
echo $visible;
|
||||
break;
|
||||
case 'rating':
|
||||
echo $rating;
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* Fires for each registered custom link column.
|
||||
*
|
||||
|
@ -211,9 +218,11 @@ class WP_Links_List_Table extends WP_List_Table {
|
|||
* @param int $link_id Link ID.
|
||||
*/
|
||||
do_action( 'manage_link_custom_column', $column_name, $link->link_id );
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
echo $this->handle_row_actions( $link, $column_name, $primary );
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -221,4 +230,27 @@ class WP_Links_List_Table extends WP_List_Table {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3
|
||||
* @access protected
|
||||
*
|
||||
* @param object $link Link being acted upon
|
||||
* @param string $column_name Current column name
|
||||
* @param string $primary Primary column name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function handle_row_actions( $link, $column_name, $primary ) {
|
||||
if( $primary === $column_name ) {
|
||||
$edit_link = get_edit_bookmark_link( $link );
|
||||
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>";
|
||||
return $this->row_actions($actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -794,6 +794,46 @@ class WP_List_Table {
|
|||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of primary column.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string Filtered name of primary column
|
||||
*/
|
||||
protected function get_primary_column_name() {
|
||||
$columns = $this->get_columns();
|
||||
$default = $this->get_default_primary_column_name();
|
||||
/**
|
||||
* Filter the name of the primary column for the current list table, with context as argument (eg: 'plugins').
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @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
|
||||
*
|
||||
|
@ -834,7 +874,8 @@ class WP_List_Table {
|
|||
$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;
|
||||
}
|
||||
|
@ -1062,16 +1103,20 @@ class WP_List_Table {
|
|||
* @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 column-primary';
|
||||
}
|
||||
|
||||
$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 '<th scope="row" class="check-column">';
|
||||
|
@ -1081,16 +1126,34 @@ class WP_List_Table {
|
|||
elseif ( method_exists( $this, 'column_' . $column_name ) ) {
|
||||
echo "<td $attributes>";
|
||||
echo call_user_func( array( $this, 'column_' . $column_name ), $item );
|
||||
echo $this->handle_row_actions( $item, $column_name, $primary );
|
||||
echo "</td>";
|
||||
}
|
||||
else {
|
||||
echo "<td $attributes>";
|
||||
echo $this->column_default( $item, $column_name );
|
||||
echo $this->handle_row_actions( $item, $column_name, $primary );
|
||||
echo "</td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @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)
|
||||
*
|
||||
|
|
|
@ -308,19 +308,22 @@ class WP_Media_List_Table extends WP_List_Table {
|
|||
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
|
||||
<?php
|
||||
|
||||
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 column-primary';
|
||||
}
|
||||
|
||||
$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':
|
||||
if ( 'cb' === $column_name ) {
|
||||
?>
|
||||
<th scope="row" class="check-column">
|
||||
<?php if ( $user_can_edit ) { ?>
|
||||
|
@ -329,190 +332,171 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
|||
<?php } ?>
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
} else {
|
||||
echo "<td $attributes>";
|
||||
|
||||
case 'icon':
|
||||
list( $mime ) = explode( '/', $post->post_mime_type );
|
||||
$attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
|
||||
if ( $this->is_trash || ! $user_can_edit ) {
|
||||
echo $thumb;
|
||||
} else {
|
||||
?>
|
||||
<a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
|
||||
<?php echo $thumb; ?>
|
||||
</a>
|
||||
switch ( $column_name ) {
|
||||
case 'icon':
|
||||
list( $mime ) = explode( '/', $post->post_mime_type );
|
||||
$attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
|
||||
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
?>
|
||||
<td <?php echo $attributes ?>><strong>
|
||||
<?php if ( $this->is_trash || ! $user_can_edit ) {
|
||||
echo $att_title;
|
||||
} else { ?>
|
||||
<a href="<?php echo get_edit_post_link( $post->ID ); ?>"
|
||||
title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
|
||||
<?php echo $att_title; ?></a>
|
||||
<?php };
|
||||
_media_states( $post ); ?></strong>
|
||||
<p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
|
||||
<?php
|
||||
echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
printf( '<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
|
||||
get_the_author()
|
||||
);
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'desc':
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
if ( '0000-00-00 00:00:00' == $post->post_date ) {
|
||||
$h_time = __( 'Unpublished' );
|
||||
} else {
|
||||
$m_time = $post->post_date;
|
||||
$time = get_post_time( 'G', true, $post, false );
|
||||
if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
|
||||
if ( $t_diff < 0 )
|
||||
$h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
|
||||
else
|
||||
$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
|
||||
} else {
|
||||
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php echo $h_time ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'parent':
|
||||
if ( $post->post_parent > 0 )
|
||||
$parent = get_post( $post->post_parent );
|
||||
else
|
||||
$parent = false;
|
||||
|
||||
if ( $parent ) {
|
||||
$title = _draft_or_post_title( $post->post_parent );
|
||||
$parent_type = get_post_type_object( $parent->post_type );
|
||||
?>
|
||||
<td <?php echo $attributes ?>><strong>
|
||||
<?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
|
||||
<a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
|
||||
<?php echo $title ?></a><?php
|
||||
} else {
|
||||
echo $title;
|
||||
} ?></strong>,
|
||||
<?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
|
||||
<?php
|
||||
if ( $user_can_edit ):
|
||||
$detach_url = add_query_arg( array(
|
||||
'parent_post_id' => $post->post_parent,
|
||||
'media[]' => $post->ID,
|
||||
'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
|
||||
), 'upload.php' ); ?>
|
||||
<a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
|
||||
<?php if ( $user_can_edit ) { ?>
|
||||
<a class="hide-if-no-js"
|
||||
onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
|
||||
href="#the-list">
|
||||
<?php _e( 'Attach' ); ?></a>
|
||||
<?php } ?></td>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
$attributes = 'class="comments column-comments num"' . $style;
|
||||
?>
|
||||
<td <?php echo $attributes ?>>
|
||||
<div class="post-com-count-wrapper">
|
||||
<?php
|
||||
$pending_comments = get_pending_comments_num( $post->ID );
|
||||
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( 'categories' == $column_name )
|
||||
$taxonomy = 'category';
|
||||
elseif ( 'tags' == $column_name )
|
||||
$taxonomy = 'post_tag';
|
||||
elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
|
||||
$taxonomy = substr( $column_name, 9 );
|
||||
else
|
||||
$taxonomy = false;
|
||||
|
||||
if ( $taxonomy ) {
|
||||
echo '<td ' . $attributes . '>';
|
||||
if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
|
||||
$out = array();
|
||||
foreach ( $terms as $t ) {
|
||||
$posts_in_term_qv = array();
|
||||
$posts_in_term_qv['taxonomy'] = $taxonomy;
|
||||
$posts_in_term_qv['term'] = $t->slug;
|
||||
|
||||
$out[] = sprintf( '<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
|
||||
esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
|
||||
);
|
||||
if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
|
||||
if ( $this->is_trash || ! $user_can_edit ) {
|
||||
echo $thumb;
|
||||
} else { ?>
|
||||
<a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
|
||||
<?php echo $thumb; ?>
|
||||
</a><?php
|
||||
}
|
||||
}
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
echo join( __( ', ' ), $out );
|
||||
} else {
|
||||
echo '—';
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
?>
|
||||
<td <?php echo $attributes ?>><?php
|
||||
/**
|
||||
* Fires for each custom column in the Media list table.
|
||||
*
|
||||
* Custom columns are registered using the 'manage_media_columns' filter.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $column_name Name of the custom column.
|
||||
* @param int $post_id Attachment ID.
|
||||
*/
|
||||
do_action( 'manage_media_custom_column', $column_name, $post->ID );
|
||||
?></td>
|
||||
<strong>
|
||||
<?php if ( $this->is_trash || ! $user_can_edit ) {
|
||||
echo $att_title;
|
||||
} else { ?>
|
||||
<a href="<?php echo get_edit_post_link( $post->ID ); ?>"
|
||||
title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
|
||||
<?php echo $att_title; ?></a>
|
||||
<?php }
|
||||
_media_states( $post ); ?></strong>
|
||||
<p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
|
||||
<?php
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
printf( '<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
|
||||
get_the_author()
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'desc':
|
||||
echo has_excerpt() ? $post->post_excerpt : '';
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
if ( '0000-00-00 00:00:00' == $post->post_date ) {
|
||||
$h_time = __( 'Unpublished' );
|
||||
} else {
|
||||
$m_time = $post->post_date;
|
||||
$time = get_post_time( 'G', true, $post, false );
|
||||
if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
|
||||
if ( $t_diff < 0 )
|
||||
$h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
|
||||
else
|
||||
$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
|
||||
} else {
|
||||
$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
|
||||
}
|
||||
}
|
||||
|
||||
echo $h_time;
|
||||
break;
|
||||
|
||||
case 'parent':
|
||||
if ( $post->post_parent > 0 )
|
||||
$parent = get_post( $post->post_parent );
|
||||
else
|
||||
$parent = false;
|
||||
|
||||
if ( $parent ) {
|
||||
$title = _draft_or_post_title( $post->post_parent );
|
||||
$parent_type = get_post_type_object( $parent->post_type );
|
||||
?>
|
||||
<strong>
|
||||
<?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
|
||||
<a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
|
||||
<?php echo $title ?></a><?php
|
||||
} else {
|
||||
echo $title;
|
||||
} ?></strong>,
|
||||
<?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
|
||||
<?php
|
||||
if ( $user_can_edit ):
|
||||
$detach_url = add_query_arg( array(
|
||||
'parent_post_id' => $post->post_parent,
|
||||
'media[]' => $post->ID,
|
||||
'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
|
||||
), 'upload.php' ); ?>
|
||||
<a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
|
||||
<?php endif;
|
||||
} else {
|
||||
_e( '(Unattached)' ); ?><br />
|
||||
<?php if ( $user_can_edit ) { ?>
|
||||
<a class="hide-if-no-js"
|
||||
onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
|
||||
href="#the-list">
|
||||
<?php _e( 'Attach' ); ?></a>
|
||||
<?php }
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
echo '<div class="post-com-count-wrapper">';
|
||||
|
||||
$pending_comments = get_pending_comments_num( $post->ID );
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
|
||||
echo '</div>';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( 'categories' == $column_name )
|
||||
$taxonomy = 'category';
|
||||
elseif ( 'tags' == $column_name )
|
||||
$taxonomy = 'post_tag';
|
||||
elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
|
||||
$taxonomy = substr( $column_name, 9 );
|
||||
else
|
||||
$taxonomy = false;
|
||||
|
||||
if ( $taxonomy ) {
|
||||
if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
|
||||
$out = array();
|
||||
foreach ( $terms as $t ) {
|
||||
$posts_in_term_qv = array();
|
||||
$posts_in_term_qv['taxonomy'] = $taxonomy;
|
||||
$posts_in_term_qv['term'] = $t->slug;
|
||||
|
||||
$out[] = sprintf( '<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
|
||||
esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
|
||||
);
|
||||
}
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
echo join( __( ', ' ), $out );
|
||||
} else {
|
||||
echo '—';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires for each custom column in the Media list table.
|
||||
*
|
||||
* Custom columns are registered using the 'manage_media_columns' filter.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $column_name Name of the custom column.
|
||||
* @param int $post_id Attachment ID.
|
||||
*/
|
||||
do_action( 'manage_media_custom_column', $column_name, $post->ID );
|
||||
break;
|
||||
}
|
||||
|
||||
if( $primary === $column_name ) {
|
||||
echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -520,6 +504,18 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
|||
<?php endwhile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'title';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WP_Post $post
|
||||
* @param string $att_title
|
||||
|
|
|
@ -246,33 +246,42 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
|
||||
$blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->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 column-primary';
|
||||
}
|
||||
|
||||
$style = '';
|
||||
if ( in_array( $column_name, $hidden ) )
|
||||
if ( in_array( $column_name, $hidden ) ) {
|
||||
$style = ' style="display:none;"';
|
||||
}
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'cb': ?>
|
||||
<th scope="row" class="check-column">
|
||||
<?php if ( ! is_main_site( $blog['blog_id'] ) ) : ?>
|
||||
<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
|
||||
<input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
$attributes = "class='$classes'$style";
|
||||
|
||||
case 'id':?>
|
||||
<th scope="row">
|
||||
<?php echo $blog['blog_id'] ?>
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
if ( 'cb' === $column_name ) {
|
||||
?>
|
||||
<th scope="row" class="check-column">
|
||||
<?php if ( ! is_main_site( $blog['blog_id'] ) ) : ?>
|
||||
<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
|
||||
<input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<?php
|
||||
} elseif ( 'id' === $column_name ) {
|
||||
?>
|
||||
<th scope="row">
|
||||
<?php echo $blog['blog_id'] ?>
|
||||
</th>
|
||||
<?php
|
||||
} else {
|
||||
echo "<td $attributes>";
|
||||
|
||||
case 'blogname':
|
||||
echo "<td class='column-$column_name $column_name'$style>"; ?>
|
||||
switch ( $column_name ) {
|
||||
case 'blogname':
|
||||
?>
|
||||
<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
|
||||
<?php
|
||||
if ( 'list' != $mode ) {
|
||||
|
@ -281,85 +290,21 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
echo '<p>' . sprintf( __( '%1$s – <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
|
||||
restore_current_blog();
|
||||
}
|
||||
break;
|
||||
|
||||
// Preordered.
|
||||
$actions = array(
|
||||
'edit' => '', 'backend' => '',
|
||||
'activate' => '', 'deactivate' => '',
|
||||
'archive' => '', 'unarchive' => '',
|
||||
'spam' => '', 'unspam' => '',
|
||||
'delete' => '',
|
||||
'visit' => '',
|
||||
);
|
||||
case 'lastupdated':
|
||||
echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
|
||||
break;
|
||||
|
||||
$actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
|
||||
$actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
|
||||
if ( get_current_site()->blog_id != $blog['blog_id'] ) {
|
||||
if ( $blog['deleted'] == '1' ) {
|
||||
$actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( $blog['archived'] == '1' ) {
|
||||
$actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( $blog['spam'] == '1' ) {
|
||||
$actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
|
||||
$actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
|
||||
}
|
||||
case 'registered':
|
||||
if ( $blog['registered'] == '0000-00-00 00:00:00' ) {
|
||||
echo '—';
|
||||
} else {
|
||||
echo mysql2date( $date, $blog['registered'] );
|
||||
}
|
||||
break;
|
||||
|
||||
$actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'lastupdated':
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'registered':
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
if ( $blog['registered'] == '0000-00-00 00:00:00' )
|
||||
echo '—';
|
||||
else
|
||||
echo mysql2date( $date, $blog['registered'] );
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'users':
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
case 'users':
|
||||
$blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) );
|
||||
if ( is_array( $blogusers ) ) {
|
||||
$blogusers_warning = '';
|
||||
|
@ -376,41 +321,38 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
if ( $blogusers_warning != '' )
|
||||
echo '<strong>' . $blogusers_warning . '</strong><br />';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'plugins': ?>
|
||||
<?php if ( has_filter( 'wpmublogsaction' ) ) {
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
/**
|
||||
* Fires inside the auxiliary 'Actions' column of the Sites list table.
|
||||
*
|
||||
* By default this column is hidden unless something is hooked to the action.
|
||||
*
|
||||
* @since MU
|
||||
*
|
||||
* @param int $blog_id The site ID.
|
||||
*/
|
||||
do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
|
||||
</td>
|
||||
<?php }
|
||||
break;
|
||||
case 'plugins':
|
||||
if ( has_filter( 'wpmublogsaction' ) ) {
|
||||
/**
|
||||
* Fires inside the auxiliary 'Actions' column of the Sites list table.
|
||||
*
|
||||
* By default this column is hidden unless something is hooked to the action.
|
||||
*
|
||||
* @since MU
|
||||
*
|
||||
* @param int $blog_id The site ID.
|
||||
*/
|
||||
do_action( 'wpmublogsaction', $blog['blog_id'] );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
/**
|
||||
* Fires for each registered custom column in the Sites list table.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param string $column_name The name of the column to display.
|
||||
* @param int $blog_id The site ID.
|
||||
*/
|
||||
do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
|
||||
echo "</td>";
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* Fires for each registered custom column in the Sites list table.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param string $column_name The name of the column to display.
|
||||
* @param int $blog_id The site ID.
|
||||
*/
|
||||
do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
|
||||
break;
|
||||
}
|
||||
|
||||
echo $this->handle_row_actions( $blog, $column_name, $primary );
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -418,4 +360,92 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'blogname';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @param object $blog Blog being acted upon
|
||||
* @param string $column_name Current column name
|
||||
* @param string $primary Primary column name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function handle_row_actions( $blog, $column_name, $primary ) {
|
||||
global $current_site;
|
||||
|
||||
if ( $primary === $column_name ) {
|
||||
$blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
|
||||
|
||||
// Preordered.
|
||||
$actions = array(
|
||||
'edit' => '', 'backend' => '',
|
||||
'activate' => '', 'deactivate' => '',
|
||||
'archive' => '', 'unarchive' => '',
|
||||
'spam' => '', 'unspam' => '',
|
||||
'delete' => '',
|
||||
'visit' => '',
|
||||
);
|
||||
|
||||
$actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
|
||||
$actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
|
||||
if ( get_current_site()->blog_id != $blog['blog_id'] ) {
|
||||
if ( $blog['deleted'] == '1' ) {
|
||||
$actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( $blog['archived'] == '1' ) {
|
||||
$actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( $blog['spam'] == '1' ) {
|
||||
$actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
|
||||
} else {
|
||||
$actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
|
||||
}
|
||||
|
||||
if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
|
||||
$actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
|
||||
}
|
||||
}
|
||||
|
||||
$actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,6 +229,18 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global array $totals
|
||||
|
@ -400,7 +412,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
|
||||
echo "<tr id='$id' class='$class'>";
|
||||
|
||||
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 = '';
|
||||
|
@ -413,7 +425,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
break;
|
||||
case 'name':
|
||||
echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
|
||||
echo $this->row_actions( $actions, true );
|
||||
if ( $primary === $column_name ) {
|
||||
echo $this->row_actions($actions, true);
|
||||
}
|
||||
echo "</td>";
|
||||
break;
|
||||
case 'description':
|
||||
|
@ -451,7 +465,11 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
$theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
|
||||
echo implode( ' | ', $theme_meta );
|
||||
|
||||
echo "</div></td>";
|
||||
echo '</div>';
|
||||
if ( $primary === $column_name ) {
|
||||
echo $this->row_actions($actions, true);
|
||||
}
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -467,6 +485,10 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
* @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 "</td>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,81 +180,66 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
<tr class="<?php echo trim( $class ); ?>">
|
||||
<?php
|
||||
|
||||
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 || 'blogs' === $column_name ) {
|
||||
$classes .= ' has-row-actions';
|
||||
}
|
||||
|
||||
if ( $primary === $column_name ) {
|
||||
$classes .= ' column-primary';
|
||||
}
|
||||
|
||||
$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': ?>
|
||||
<th scope="row" class="check-column">
|
||||
<label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label>
|
||||
<input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" />
|
||||
</th>
|
||||
if ( 'cb' === $column_name ){
|
||||
?>
|
||||
<th scope="row" class="check-column">
|
||||
<label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label>
|
||||
<input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" />
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
} else {
|
||||
echo "<td $attributes>";
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'username':
|
||||
$avatar = get_avatar( $user->user_email, 32 );
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
|
||||
case 'username':
|
||||
$avatar = get_avatar( $user->user_email, 32 );
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
|
||||
echo "<td $attributes>"; ?>
|
||||
<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
|
||||
echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
|
||||
if ( in_array( $user->user_login, $super_admins ) )
|
||||
echo ' - ' . __( 'Super Admin' );
|
||||
?></strong>
|
||||
<br/>
|
||||
<?php
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
<?php
|
||||
break;
|
||||
|
||||
if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
|
||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
}
|
||||
case 'name':
|
||||
echo "$user->first_name $user->last_name";
|
||||
break;
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'email':
|
||||
echo "<a href='mailto:$user->user_email'>$user->user_email</a>";
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
echo "<td $attributes>$user->first_name $user->last_name</td>";
|
||||
break;
|
||||
case 'registered':
|
||||
if ( 'list' == $mode )
|
||||
$date = __( 'Y/m/d' );
|
||||
else
|
||||
$date = __( 'Y/m/d g:i:s a' );
|
||||
|
||||
case 'email':
|
||||
echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
|
||||
break;
|
||||
echo mysql2date( $date, $user->user_registered );
|
||||
break;
|
||||
|
||||
case 'registered':
|
||||
if ( 'list' == $mode )
|
||||
$date = __( 'Y/m/d' );
|
||||
else
|
||||
$date = __( 'Y/m/d g:i:s a' );
|
||||
|
||||
echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";
|
||||
break;
|
||||
|
||||
case 'blogs':
|
||||
$blogs = get_blogs_of_user( $user->ID, true );
|
||||
echo "<td $attributes>";
|
||||
case 'blogs':
|
||||
$blogs = get_blogs_of_user( $user->ID, true );
|
||||
if ( is_array( $blogs ) ) {
|
||||
foreach ( (array) $blogs as $key => $val ) {
|
||||
if ( !can_edit_network( $val->site_id ) )
|
||||
|
@ -305,17 +290,16 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
echo '</small></span><br/>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "<td $attributes>";
|
||||
/** 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 "</td>";
|
||||
break;
|
||||
default:
|
||||
/** 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 );
|
||||
break;
|
||||
}
|
||||
|
||||
echo $this->handle_row_actions( $user, $column_name, $primary );
|
||||
echo '</td>';
|
||||
}
|
||||
endforeach
|
||||
?>
|
||||
|
@ -323,4 +307,55 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'username';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @param object $user User being acted upon
|
||||
* @param string $column_name Current column name
|
||||
* @param string $primary Primary column name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function handle_row_actions( $user, $column_name, $primary ) {
|
||||
$super_admins = get_super_admins();
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||
|
||||
if ( $primary === $column_name ) {
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
|
||||
if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
|
||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,24 +568,36 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$plugin_slug
|
||||
);
|
||||
|
||||
list( $columns, $hidden ) = $this->get_column_info();
|
||||
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
|
||||
|
||||
$extra_class = ' has-row-actions column-primary';
|
||||
|
||||
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':
|
||||
echo "<th scope='row' class='check-column'>$checkbox</th>";
|
||||
break;
|
||||
case 'name':
|
||||
echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
|
||||
echo $this->row_actions( $actions, true );
|
||||
if ( $primary === $column_name || ! isset( $columns[ $primary ] ) ) {
|
||||
echo "<td class='plugin-title $extra_class'$style><strong>$plugin_name</strong>";
|
||||
echo $this->row_actions( $actions, true );
|
||||
} else {
|
||||
echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
|
||||
}
|
||||
echo "</td>";
|
||||
break;
|
||||
case 'description':
|
||||
echo "<td class='column-description desc'$style>
|
||||
$classes = 'column-description desc';
|
||||
if ( $primary === $column_name ) {
|
||||
$classes .= " $extra_class";
|
||||
}
|
||||
|
||||
echo "<td class='$classes'$style>
|
||||
<div class='plugin-description'>$description</div>
|
||||
<div class='$class second plugin-version-author-uri'>";
|
||||
|
||||
|
@ -632,10 +644,18 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$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 "</div></td>";
|
||||
break;
|
||||
default:
|
||||
echo "<td class='$column_name column-$column_name'$style>";
|
||||
$classes = "$column_name column-$column_name$class";
|
||||
if ( $primary === $column_name ) {
|
||||
$classes .= " $extra_class";
|
||||
}
|
||||
|
||||
echo "<td class='$classes'$style>";
|
||||
|
||||
/**
|
||||
* Fires inside each custom column of the Plugins list table.
|
||||
|
@ -647,6 +667,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
* @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 "</td>";
|
||||
}
|
||||
}
|
||||
|
@ -682,4 +706,16 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
*/
|
||||
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.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'plugin';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -684,16 +684,20 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
|
||||
<?php
|
||||
|
||||
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 column-primary';
|
||||
}
|
||||
|
||||
$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 ) {
|
||||
|
||||
|
@ -715,7 +719,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
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.
|
||||
|
@ -772,65 +777,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
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'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
|
||||
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>';
|
||||
}
|
||||
if ( current_user_can( 'delete_post', $post->ID ) ) {
|
||||
if ( 'trash' == $post->post_status )
|
||||
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
|
||||
elseif ( EMPTY_TRASH_DAYS )
|
||||
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
|
||||
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
|
||||
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
|
||||
}
|
||||
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'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
|
||||
}
|
||||
} elseif ( 'trash' != $post->post_status ) {
|
||||
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
echo $this->handle_row_actions( $post, $column_name, $primary );
|
||||
|
||||
get_inline_data( $post );
|
||||
echo '</td>';
|
||||
|
@ -887,6 +834,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
} else {
|
||||
_e( 'Last Modified' );
|
||||
}
|
||||
echo $this->handle_row_actions( $post, $column_name, $primary );
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
|
@ -898,7 +846,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
?>
|
||||
</div></td>
|
||||
</div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
@ -909,6 +857,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
|
||||
get_the_author()
|
||||
);
|
||||
echo $this->handle_row_actions( $post, $column_name, $primary );
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
|
@ -949,6 +898,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
} else {
|
||||
echo '—';
|
||||
}
|
||||
echo $this->handle_row_actions( $post, $column_name, $primary );
|
||||
echo '</td>';
|
||||
break;
|
||||
}
|
||||
|
@ -995,6 +945,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
* @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 );
|
||||
?></td>
|
||||
<?php
|
||||
break;
|
||||
|
@ -1006,6 +957,101 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
$GLOBALS['post'] = $global_post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return( 'title' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @param object $post Post being acted upon
|
||||
* @param string $column_name Current column name
|
||||
* @param string $primary Primary column name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function handle_row_actions( $post, $column_name, $primary ) {
|
||||
$title = _draft_or_post_title();
|
||||
|
||||
if ( $primary === $column_name ) {
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
$can_edit_post = current_user_can( 'edit_post', $post->ID );
|
||||
$actions = array();
|
||||
|
||||
if ( $can_edit_post && 'trash' != $post->post_status ) {
|
||||
$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
|
||||
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>';
|
||||
}
|
||||
|
||||
if ( current_user_can( 'delete_post', $post->ID ) ) {
|
||||
if ( 'trash' == $post->post_status )
|
||||
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
|
||||
elseif ( EMPTY_TRASH_DAYS )
|
||||
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
|
||||
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
|
||||
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
|
||||
}
|
||||
|
||||
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'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
|
||||
}
|
||||
} elseif ( 'trash' != $post->post_status ) {
|
||||
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
|
|
|
@ -307,9 +307,6 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
*/
|
||||
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 ) );
|
||||
|
||||
|
@ -333,42 +330,6 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
|
||||
$out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />';
|
||||
|
||||
$actions = array();
|
||||
if ( current_user_can( $tax->cap->edit_terms ) ) {
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
|
||||
}
|
||||
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
|
||||
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
|
||||
if ( $tax->public )
|
||||
$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
|
||||
|
||||
/**
|
||||
* 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 .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
|
||||
$out .= '<div class="name">' . $qe_data->name . '</div>';
|
||||
|
||||
|
@ -379,6 +340,77 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and display row actions links
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @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'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
|
||||
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
|
||||
}
|
||||
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
|
||||
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
|
||||
if ( $tax->public )
|
||||
$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -389,7 +389,6 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||
* @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 = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
|
||||
|
@ -403,63 +402,82 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||
|
||||
$r = "<tr id='user-$user_object->ID'>";
|
||||
|
||||
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 column-primary';
|
||||
}
|
||||
|
||||
$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':
|
||||
$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>";
|
||||
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='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>";
|
||||
break;
|
||||
case 'role':
|
||||
$r .= $role_name;
|
||||
break;
|
||||
case 'posts':
|
||||
$attributes = 'class="posts column-posts num"' . $style;
|
||||
$r .= "";
|
||||
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;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/**
|
||||
* Filter 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter 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 );
|
||||
$r .= "</td>";
|
||||
if ( $primary === $column_name ) {
|
||||
$r .= $this->row_actions( $actions );
|
||||
}
|
||||
$r .= "</td>";
|
||||
}
|
||||
}
|
||||
$r .= '</tr>';
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of default primary column
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access protected
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_default_primary_column_name() {
|
||||
return 'username';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32643';
|
||||
$wp_version = '4.3-alpha-32644';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue