#5596 closed defect (bug) (fixed)
Filtering groups by slug not working on Buddypress 2.0
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.0.1 | Priority: | normal |
| Severity: | normal | Version: | 2.0 |
| Component: | Groups | Keywords: | has-patch commit |
| Cc: |
Description
After upgrading to Buddypress 2.0, my bp_has_groups with filters by slug are not working anymore. Before BP 2.0, it was working if I put type=single-group into the params, but now it's not working anymore (not even with arrays or parses).
Previously working: if ( bp_has_groups (type=single-group&slug=musculacao) )
Now it returns nothing.
Attachments (2)
Change History (10)
#2
@
12 years ago
- Keywords commit added
Looks good to me, r-a-y! Thanks for the report, walmarandrade.
#3
@
12 years ago
Thanks, r-a-y! I've tested your patch and now it does filter, but the buttons (join/leave group) are not working into this specific loop. They were working before upgrade, so I think this is another case of retrocompatibility to observe.
Just for you to know, in my site I relate groups to posts, like categories. So when a user open a post he'll see the group name, avatar and button join/leave at the top of the page. In those pages I use the bp_has_groups filter using slug and type=single-group.
Eg: http://mude.nu/nova-york/
(it's in brazilian portuguese, but you get the picture)
#4
@
12 years ago
Hi walmarandrade,
I had to make one further change to account for the populate_extras parameter in groups_get_group().
This should fix the problem. Let me know if this fixes things for you.
Thanks again for testing!
#5
@
12 years ago
It works like a charm, r-a-y! Thank you, I wish I could solve problems as fast as you do, but I'm not a programmer, just a curious Buddypress enthusiast (I've 20.404 registered users now, so any problems when I upgrade appear very fast).
Anyway, I'll keep testing and reporting to contribute as I can.
Thanks again from Brazil!
Hi walmarandrade,
This is my fault. I made changes to only use the current group slug with the
'slug'parameter in r8050 for performance reasons and also because our internal code notes that the'slug'parameter is only used when'type=single-group'. And the'single-group'type is only set when we're on a single group page.I guess devs like you were exploiting this behavior so you can query a group by slug! I've attached a patch that should allow you to use
'type=single-group'and'slug'like before in BP 1.9.In a future release, we'll make it so you can use the
'slug'parameter without setting thetypetosingle-group.I would also recommend querying by group ID with the
'include'parameter whenever possible.