Opened 12 years ago
Closed 12 years ago
#5660 closed enhancement (fixed)
add parameter to bp_has_blogs filter
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Blogs | Keywords: | needs-patch good-first-bug |
| Cc: |
Description
My delight at seeing that #8042 adds the capability to filter fetched blogs with a list of IDs to include is tempered by the fact that bp_has_blogs filter does not pass the current query arguments as a parameter to the filter. This means that I cannot amend the existing query when I add a filter. The following would (almost) solve this:
return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template, $r );
I say "almost", because $r is not fully populated in that it does not include the search string if it comes from $_GET. In my opinion, bp_has_groups() is exemplary in this respect.
Change History (4)
#1
@
12 years ago
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to 2.1
#2
@
12 years ago
That's totally and utterly splendid Boone, thanks for the heads-up. I noticed bp_parse_args() in the function but had no idea that it was such an improvement over wp_parse_args(). Makes adding the param to the filter pretty redundant. I'd be happy if you want to close this.
needle now goes off to re-write all his plugins...
I don't have a problem making these adjustments to the filter, but I should note that probably the best way to do what you're suggesting is by using the
bp_parse_args()filters introduced to template functions in BP 2.0. This will help you to avoid double queries. See http://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/ for more details.