Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 4 years ago

#5596 closed defect (bug) (fixed)

Filtering groups by slug not working on Buddypress 2.0

Reported by: walmarandrade's profile walmarandrade Owned by: johnjamesjacoby's profile johnjamesjacoby
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)

5596.01.patch (3.0 KB) - added by r-a-y 10 years ago.
5596.02.patch (3.2 KB) - added by r-a-y 10 years ago.

Download all attachments as: .zip

Change History (10)

#1 @r-a-y
10 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.0.1

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 the type to single-group.

I would also recommend querying by group ID with the 'include' parameter whenever possible.

@r-a-y
10 years ago

#2 @boonebgorges
10 years ago

  • Keywords commit added

Looks good to me, r-a-y! Thanks for the report, walmarandrade.

#3 @walmarandrade
10 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)


@r-a-y
10 years ago

#4 @r-a-y
10 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 @walmarandrade
10 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!

#6 @johnjamesjacoby
10 years ago

Tested, worksforme. Go ahead and commit at your leisure.

#7 @johnjamesjacoby
10 years ago

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

In 8328:

Backwards compatibility for querying single groups via the slug argument. Props r-a-y. Fixes #5596. (2.0 branch)

#8 @johnjamesjacoby
10 years ago

In 8329:

Backwards compatibility for querying single groups via the slug argument. Props r-a-y. Fixes #5596. (trunk)

Note: See TracTickets for help on using tickets.