Make WordPress Core

Opened 17 years ago

Last modified 17 months ago

#12960 new enhancement

Number of posts on the Users page should include drafts and pending review

Reported by: archon810 Owned by:
Priority: normal Milestone:
Component: Users Version: 2.9.2
Severity: normal Keywords: has-patch needs-unit-tests 2nd-opinion
Cc: Focuses:

Description

The numbers of posts on the Users page currently only include published posts, which I think is not good enough. For example, I have a contributor who has only written a few drafts and submitted a few articles for review.

If I decide to delete him and base my decision on what I see on the Users page, I would probably just go with the "Delete the user and all his posts" option, which would delete more than I would expect.

Attachments (4)

12960.diff​ (486 bytes ) - added by wojtek.szkutnik 16 years ago.
12960.1.diff​ (1.2 KB ) - added by Nikschavan 10 years ago.
12960.2.diff​ (665 bytes ) - added by Nikschavan 10 years ago.
12960.3.diff​ (5.5 KB ) - added by donmhico 7 years ago.

Download all attachments as: .zip

Change History (15)

#1 @archon810
17 years ago

  • Cc admin@… added

#2 @wojtek.szkutnik
16 years ago

  • Keywords gsoc has-patch needs-testing added

Indeed, scheduled, pending and draft posts should be counted as well

#3 @wojtek.szkutnik
16 years ago

  • Cc wojtek.szkutnik@… added

#4 @nacin
16 years ago

  • Milestone Awaiting Review → Future Release

#5 @chriscct7
12 years ago

  • Keywords needs-testing removed

Patch is still good

#7 @chriscct7
11 years ago

  • Keywords needs-refresh added; gsoc removed

#8 @Nikschavan
10 years ago

  • Keywords needs-testing added; needs-refresh removed

Refreshed the patch with current trunk in 12960.2.diff

This needs to be tested as the function get_posts_by_author_sql is also used in WP_User_Query->parse_orderby()

#9 @archon810
7 years ago

This ticket is now 10 years old. Ping?

#10 follow-up: @donmhico
7 years ago

Thanks for the ticket @archon810. Yeah it's 10 years old now! Hopefully this could gain traction soon.

While @Nikschavan patch works (thanks for the patch!), I don't think directly changing the SQL inside get_posts_by_author_sql() is the best approach since it could lead to unwanted changes to any plugins / themes that uses the function.

In my latest patch, 12960.3.diff, I introduced a new parameter $include_unpublished which if set to true would add the SQL that will include pending, future, and draft posts.

#11 in reply to: ↑ 10 @SirLouen
17 months ago

  • Keywords needs-unit-tests 2nd-opinion added; needs-testing removed

Replying to donmhico:

Thanks for the ticket @archon810. Yeah it's 10 years old now! Hopefully this could gain traction soon.

While @Nikschavan patch works (thanks for the patch!), I don't think directly changing the SQL inside get_posts_by_author_sql() is the best approach since it could lead to unwanted changes to any plugins / themes that uses the function.

In my latest patch, 12960.3.diff, I introduced a new parameter $include_unpublished which if set to true would add the SQL that will include pending, future, and draft posts.

Why not just add a filter to include unpublished? (2nd-opinion)

Furthermore, some units test in tests/phpunit/tests/user.php with whatever decision is taken, could be adequate.

Note: See TracTickets for help on using tickets.