Opened 15 years ago
Closed 12 years ago
#2698 closed defect (bug) (no action required)
bp_has_groups can't read slug
| Reported by: |
|
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)
#2
@
14 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
@
14 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
@
14 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.
#6
@
14 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 ) ) { // ...
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.