Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 11 years ago

#2354 closed enhancement (fixed)

Add filter for dropdown arguments in bbp_get_dropdown

Reported by: nofearinc's profile nofearinc Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.4 Priority: normal
Severity: normal Version: 2.1
Component: Tools - Code Improvements Keywords:
Cc:

Description

bbp_get_dropdown in includes/common/template-tags.php is fetching entries with get_posts based on input arguments for all bbPress dropdown filters. The arguments passed to get_posts could not be filtered from plugins.

I would suggest adding a filter to the get_posts arguments array for external manipulation for dropdowns.

Attachments (1)

template-tags-filter.diff (438 bytes) - added by nofearinc 11 years ago.
includes/common/template-tags.php filter added for get_posts args

Download all attachments as: .zip

Change History (8)

@nofearinc
11 years ago

includes/common/template-tags.php filter added for get_posts args

#1 @johnjamesjacoby
11 years ago

Is this something you can solve using the passive and aggressive filters in bbp_parse_args()

  • bbp_before_get_dropdown_parse_args
  • bbp_after_get_dropdown_parse_args

#2 @nofearinc
11 years ago

  • Keywords close added; has-patch removed
  • Resolution set to invalid
  • Status changed from new to closed

Yes, bbp_after_get_dropdown_parse_args would do the work here, thanks

#3 @johnjamesjacoby
11 years ago

  • Milestone Awaiting Review deleted

#4 @nofearinc
11 years ago

  • Keywords close removed
  • Resolution invalid deleted
  • Status changed from closed to reopened

I'm reopening this ticket as the post_status is set after the filter in question.

This snippet could be found after those filters, before get_posts in template-tags.php:

		// Define local variable(s)
		$post_stati = array();

		// Public
		$post_stati[] = bbp_get_public_status_id();

Therefore I cannot modify the post status.

#5 @nofearinc
11 years ago

  • Milestone set to Awaiting Review

#6 @johnjamesjacoby
11 years ago

  • Component changed from Actions/Filters to Code Improvement
  • Milestone changed from Awaiting Review to 2.4

#7 @johnjamesjacoby
11 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from reopened to closed

In 5010:

In bbp_get_dropdown(), remove the hard-coded post_status checker, and trust bbp_pre_get_posts_normalize_forum_visibility() to do its job. We still pass 'post_status' as null, so that get_posts() gets passed the results of bbp_parse_args(). Also, remove 'sort_column' array key from when this used get_pages(), and rely on 'orderby' for get_posts() instead.

In bbp_pre_get_posts_normalize_forum_visibility(), remove empties and duplicates from the $post_stati array.

Fixes #2354.

Note: See TracTickets for help on using tickets.