Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 11 years ago

#2698 closed defect (bug) (no action required)

bp_has_groups can't read slug

Reported by: kayue's profile kayue Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Groups Keywords: needs-patch
Cc: yoshu

Description

bp_has_groups() doesn't take slug parameter as the docs said (http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-groups-loop/)

Is there anyway we can get a specific group's information?

Change History (7)

#1 @DJPaul
14 years ago

  • Resolution set to invalid
  • Status changed from new to closed

It does. Can you post this on the forums please (http://buddypress.org/support/topics/), as it is a support request and not a bug report. We'd need to see the relevant section of code to help out.

#2 @yoshu
13 years ago

  • Cc yoshu added
  • Resolution invalid deleted
  • Severity set to normal
  • Status changed from closed to reopened

This looks like a bug to me. The following if statement should return false since there is no slug such as "gibberish". The other parameters like "max" and "user_id" work as expected.

<?php

global $current_user;
get_currentuserinfo();

$arrrr = array(
	'slug' => 'gibberish',
	'max' => '1',
	'user_id' => $current_user->ID
);

if ( bp_has_groups ( $arrrr ) ) {
	echo 'Your ID is ' . ($current_user->ID );
	echo '<br> Yarrr matey! <br>';
	echo bp_groups_pagination_count() . "<br>";
} else {
	echo 'you're not a member of this group <br>';
}
?>

#3 @boonebgorges
13 years ago

  • Milestone changed from 1.5 to Awaiting Review

Moving to Awaiting Review so that it can be tested by a core dev.

#4 @DJPaul
13 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from major to normal

What's happening is that the slug parameter is only used in BP_Groups_Template's constructor if type="single_group" (so that's a workaround for now).

We should update groups_get_groups() to accept the slug parameter.

#5 @ankurm
13 years ago

when will this bug be fixed? i cant get groups to work as required...

#6 @boonebgorges
13 years ago

It will be fixed when someone patches it :)

As DJPaul suggests above, for the moment you can use the 'slug' parameter by also passing

'type' => 'single_group'

into the bp_has_groups() array. Eg,

$arrrr = array(
	'slug' => 'gibberish',
	'max' => '1',
	'user_id' => $current_user->ID,
        'type' => 'single_group'
);

if ( bp_has_groups ( $arrrr ) ) { // ... 

#7 @boonebgorges
11 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Closing due to lack of activity, and because 'single-group' is a reasonable workaround.

Note: See TracTickets for help on using tickets.