Skip to:
Content

bbPress.org

Opened 7 years ago

Last modified 7 years ago

#3196 new enhancement

Improve bbp_get_statistics() to use registered statuses

Reported by: casiepa's profile casiepa Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: trunk
Component: General Keywords:
Cc:

Description (last modified by johnjamesjacoby)

The bbp_get_statistics() function is one of our oldest, and is used to populate the "At a Glance" Dashboard meta-box with counts for forums, topics, replies, etc...

Internally, this function does not care about what statuses are made available to post types, but rather is hard-coded to only support specific post types (the purpose of the original function was to only show public counts.)

Though custom post status support is still not completely implemented inside of WordPress, we do include our own helper functions for getting the appropriate statuses for them. We should use these functions, objects, and labels, to show counts by status for what the user is able to view. We should also cache these results based on the combination of counts made available to the user, so these statistics can be used in a more traditional forum type way.

Change History (3)

#1 @johnjamesjacoby
7 years ago

Found it: r6542

We're using array_filter() on the $counts array to remove keys with empty values.

bbp_filter_dashboard_glance_items() specifically does not count a bunch of private/hidden statuses.

I would like to repurpose this issue into one that we can use to refactor bbp_get_statistics() to use known & registered statuses instead of hardcoding each of them as they are and have been.

#2 @johnjamesjacoby
7 years ago

  • Description modified (diff)
  • Milestone changed from 2.6 to 2.8
  • Summary changed from Hidden counters no longer visible in bbp_get_statistics to Improve bbp_get_statistics() to use registered statuses
  • Type changed from defect to enhancement

#3 @johnjamesjacoby
7 years ago

In 6786:

Stats: Whitespace adjustments to some statistics functions.

See #3196.

Note: See TracTickets for help on using tickets.