summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes/class-wp-list-table.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin/includes/class-wp-list-table.php')
-rw-r--r--wp-admin/includes/class-wp-list-table.php33
1 files changed, 15 insertions, 18 deletions
diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php
index b3aebd9..4e6aaa4 100644
--- a/wp-admin/includes/class-wp-list-table.php
+++ b/wp-admin/includes/class-wp-list-table.php
@@ -319,7 +319,7 @@ class WP_List_Table {
);
if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
+ $args['total_pages'] = (int) ceil( $args['total_items'] / $args['per_page'] );
}
// Redirect if page number is invalid and headers are not already sent.
@@ -564,7 +564,7 @@ class WP_List_Table {
*
* @since 3.1.0
*
- * @param string $which The location of the bulk actions: 'top' or 'bottom'.
+ * @param string $which The location of the bulk actions: Either 'top' or 'bottom'.
* This is designated as optional for backward compatibility.
*/
protected function bulk_actions( $which = '' ) {
@@ -828,6 +828,17 @@ class WP_List_Table {
* @param int $pending_comments Number of pending comments.
*/
protected function comments_bubble( $post_id, $pending_comments ) {
+ $post_object = get_post( $post_id );
+ $edit_post_cap = $post_object ? 'edit_post' : 'edit_posts';
+
+ if ( ! current_user_can( $edit_post_cap, $post_id )
+ && ( post_password_required( $post_id )
+ || ! current_user_can( 'read_post', $post_id ) )
+ ) {
+ // The user has no access to the post and thus cannot see the comments.
+ return false;
+ }
+
$approved_comments = get_comments_number();
$approved_comments_number = number_format_i18n( $approved_comments );
@@ -851,20 +862,6 @@ class WP_List_Table {
$pending_comments_number
);
- $post_object = get_post( $post_id );
- $edit_post_cap = $post_object ? 'edit_post' : 'edit_posts';
- if (
- current_user_can( $edit_post_cap, $post_id ) ||
- (
- empty( $post_object->post_password ) &&
- current_user_can( 'read_post', $post_id )
- )
- ) {
- // The user has access to the post and thus can see comments
- } else {
- return false;
- }
-
if ( ! $approved_comments && ! $pending_comments ) {
// No comments at all.
printf(
@@ -1015,7 +1012,7 @@ class WP_List_Table {
*
* @since 3.1.0
*
- * @param string $which
+ * @param string $which The location of the pagination: Either 'top' or 'bottom'.
*/
protected function pagination( $which ) {
if ( empty( $this->_pagination_args ) ) {
@@ -1666,7 +1663,7 @@ class WP_List_Table {
* Generates the table navigation above or below the table
*
* @since 3.1.0
- * @param string $which
+ * @param string $which The location of the navigation: Either 'top' or 'bottom'.
*/
protected function display_tablenav( $which ) {
if ( 'top' === $which ) {