Make WordPress Core

Opened 10 years ago

Last modified 3 months ago

#33216 new defect (bug)

Users.php post count is not accurate as it does not include drafts.

Reported by: emirpprime's profile emirpprime Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: administration Cc:

Description

On Users.php, the post count for users does not include Draft posts. However if you click on the number to view the Users' posts, the view presented does include drafts. I consider this a UX bug.
More seriously when, for example, deleting unused users, this number indicates a user has no posts when in fact they may have Draft posts. This can lead to posts being deleted when the users is deleted in the belief they have no (post) content. This is a much more serious UX problem as it can result in loss of content.

I have attached a patch to add another variable to get_posts_by_author_sql() and count_many_users_posts() / count_user_posts() to allow the inclusion of drafts. The variable is set to false by default so it does not effect any existing use of the functions.

Attachments (1)

#33216 (4.8 KB) - added by emirpprime 10 years ago.
Patch for bug described in ticket.

Download all attachments as: .zip

Change History (7)

@emirpprime
10 years ago

Patch for bug described in ticket.

#1 @SergeyBiryukov
10 years ago

  • Component changed from Administration to Users
  • Focuses administration added

#2 @emirpprime
10 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by obenland. View the logs.


10 years ago

#4 @obenland
10 years ago

  • Version trunk deleted

#5 @johnjamesjacoby
3 months ago

This is (or was) by design.

See #21431.

#6 @emirpprime
3 months ago

Interesting - #21431 looks like it was a performance fix for the underlying function, but I stand by this being a not-insignificant UX issue and this patch a step forward.

That said I actually think my patch doesn't go far enough - to be informative and deliver the implied/expected data on the users screen I believe the count should really include all posts from a user (including draft, private, and custom statuses) except inherit, auto-draft and trash (that might be simplified as all except trash and those marked as internal - but I'd have to check). It could be filterable so that plugins can exclude statuses as required (eg some concept of a custom trash status relevant only to that plugin).
However that's a much bigger change that would definitely need some bigger voices in the discussion to decide whether it is worth persueing.

Note: See TracTickets for help on using tickets.