Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#21431 closed enhancement (fixed)

Allow count_many_users_posts() to count only public posts

Reported by: ryan Owned by: nacin
Priority: normal Milestone: 3.5
Component: Users Version: 3.4.1
Severity: normal Keywords: has-patch do-not-punt commit
Cc: Focuses:

Description (last modified by ryan)

count_many_users_posts() calls get_posts_by_author_sql() which contains some cap checks. This makes the output dependent on the current user and thus not very cacheable. Let's add a means of counting only public posts that skips the cap and current user checks.

Attachments (2)

21431.diff​ (5.2 KB ) - added by ryan 14 years ago.
Core patch plus corresponding changes to a plugin to provide context
21431.2.diff​ (3.0 KB ) - added by westi 14 years ago.
Updates diff against current trunk

Download all attachments as: .zip

Change History (9)

@ryan
14 years ago

Core patch plus corresponding changes to a plugin to provide context

#1 @ryan
14 years ago

Patch courtesy of Barry.

#2 @ryan
14 years ago

  • Description modified (diff)

#3 @wonderboymusic
14 years ago

  • Keywords has-patch added

#4 @nacin
14 years ago

  • Keywords do-not-punt added

#5 @westi
14 years ago

I've written some unit tests for the change in ​[UT1097]

@westi
14 years ago

Updates diff against current trunk

#6 @westi
14 years ago

  • Keywords commit added

#7 @nacin
14 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → closed

In 22386:

Add a $public_only argument to count_many_users_posts() and get_posts_by_author_sql(). Defaults to false, and allows the counts to be returned for only public posts. props ryan, westi. fixes #21431.

Note: See TracTickets for help on using tickets.