equal
deleted
inserted
replaced
114 |
114 |
115 if ( false !== $counts ) { |
115 if ( false !== $counts ) { |
116 return $counts; |
116 return $counts; |
117 } |
117 } |
118 |
118 |
119 $query = " |
119 $results = (array) $wpdb->get_results( |
120 SELECT post_status, COUNT( * ) AS num_posts |
120 $wpdb->prepare( |
121 FROM {$wpdb->posts} |
121 "SELECT post_status, COUNT( * ) AS num_posts |
122 WHERE post_type = %s |
122 FROM {$wpdb->posts} |
123 AND post_name = %s |
123 WHERE post_type = %s |
124 GROUP BY post_status"; |
124 AND post_name = %s |
125 |
125 GROUP BY post_status", |
126 $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A ); |
126 $this->post_type, |
127 $counts = array_fill_keys( get_post_stati(), 0 ); |
127 $this->request_type |
|
128 ), |
|
129 ARRAY_A |
|
130 ); |
|
131 |
|
132 $counts = array_fill_keys( get_post_stati(), 0 ); |
128 |
133 |
129 foreach ( $results as $row ) { |
134 foreach ( $results as $row ) { |
130 $counts[ $row['post_status'] ] = $row['num_posts']; |
135 $counts[ $row['post_status'] ] = $row['num_posts']; |
131 } |
136 } |
132 |
137 |
428 * Status column. |
433 * Status column. |
429 * |
434 * |
430 * @since 4.9.6 |
435 * @since 4.9.6 |
431 * |
436 * |
432 * @param WP_User_Request $item Item being shown. |
437 * @param WP_User_Request $item Item being shown. |
433 * @return string Status column markup. |
438 * @return string|void Status column markup. Returns a string if no status is found, |
|
439 * otherwise it displays the markup. |
434 */ |
440 */ |
435 public function column_status( $item ) { |
441 public function column_status( $item ) { |
436 $status = get_post_status( $item->ID ); |
442 $status = get_post_status( $item->ID ); |
437 $status_object = get_post_status_object( $status ); |
443 $status_object = get_post_status_object( $status ); |
438 |
444 |
493 * @param WP_User_Request $item Item being shown. |
499 * @param WP_User_Request $item Item being shown. |
494 * @param string $column_name Name of column being shown. |
500 * @param string $column_name Name of column being shown. |
495 */ |
501 */ |
496 public function column_default( $item, $column_name ) { |
502 public function column_default( $item, $column_name ) { |
497 /** |
503 /** |
498 * Fires for each custom column of a specific request type in the Requests list table. |
504 * Fires for each custom column of a specific request type in the Privacy Requests list table. |
499 * |
505 * |
500 * Custom columns are registered using the {@see 'manage_export-personal-data_columns'} |
506 * Custom columns are registered using the {@see 'manage_export-personal-data_columns'} |
501 * and the {@see 'manage_erase-personal-data_columns'} filters. |
507 * and the {@see 'manage_erase-personal-data_columns'} filters. |
|
508 * |
|
509 * The dynamic portion of the hook name, `$this->screen->id`, refers to the ID given to the list table |
|
510 * according to which screen it's displayed on. |
|
511 * |
|
512 * Possible hook names include: |
|
513 * |
|
514 * - `manage_export-personal-data_custom_column` |
|
515 * - `manage_erase-personal-data_custom_column` |
502 * |
516 * |
503 * @since 5.7.0 |
517 * @since 5.7.0 |
504 * |
518 * |
505 * @param string $column_name The name of the column to display. |
519 * @param string $column_name The name of the column to display. |
506 * @param WP_User_Request $item The item being shown. |
520 * @param WP_User_Request $item The item being shown. |