Opened 15 years ago
Closed 12 years ago
#3161 closed enhancement (fixed)
groups_get_groups should be able to process custom $type
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Groups | Keywords: | has-patch commit |
| Cc: |
Description
I would like to add a new sort order for the groups in the groups directory page. Thanks to the hook 'bp_groups_directory_order_options' (see groups/index.php in default theme), I have added an entry :
/**
* Add a sort order for the groups
*/
function bp_custom_groups_directory_order_options() { ?>
<option value="creative">Filter Label</option>
<?php
}
add_action( 'bp_groups_directory_order_options', 'bp_custom_groups_directory_order_options' );
The Ajax call made when the user changes the sort input calls successively :
- bp_has_groups() with the $type parameter set to "creative" in my case
- the constructor bp_groups_template()
- groups_get_groups()
Well in this last function the switch use the "default:" operand which means BP_Groups_Group::get_active() is called.
What should be done is a new "default:" instruction which triggers a new hook "groups_get_groups_custom_type" with $type and $args for arguments.
If you're okay with it I can provide a patch.
Attachments (1)
Change History (7)
#2
@
15 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
#3
@
12 years ago
- Milestone changed from Future Release to 2.1
- Severity set to normal
We now have 'order' and 'orderby' params for our group query methods (with 'type' as a shorthand for certain combos). I think it makes sense to put in the necessary filters to allow these value to be modified. This should be easy to put in place for 2.1.
I like this idea.