Skip to:

Re: How to query for groups



@boonebgorges I know this is a old thread, but it is exactly what I am looking for, but it is not working for me. I should say it is working, but I can’t get one parameter to work. I am using the bp_has_groups() to filter the groups loop and I need to only display certain groups either by id’s (which does not seem to be a option other the user_id) or by slug which will work, but it does not for what ever reason. I am building a search function that will search for groups within a radius of a zip code entered in by the user. My search code is not in play yet so that is not causing the issue…just trying to find a way to hook my search code into a query for the loops page and the slug option looks to be the only way unless I can use group_id’s somehow. This is how I used the slug as parameter.
`$args = array(
‘slug’ => ‘group_slug’,
‘max’ => 3,
‘user_id’ => $user_id);
if ( bp_has_groups ( $args ) ) { …’

I looked in the data base for the slug name in the bp_groups table. Not sure if that is right, but it is not working. Like I said though…the other parameters seem to work.
Thanks for any help you can give me.

Skip to toolbar