Commit 28c2d66e authored by jacob.embree's avatar jacob.embree Committed by jacob.embree

Issue #2569471 by robertom, jacob.embree: og_get_groups_by_user don't respect @return documentation

parent d16275a0
...@@ -3561,18 +3561,18 @@ function og_get_groups_by_user($account = NULL, $group_type = NULL) { ...@@ -3561,18 +3561,18 @@ function og_get_groups_by_user($account = NULL, $group_type = NULL) {
$account = $user; $account = $user;
} }
$gids = array();
if (!og_get_group_audience_fields()) { if (!og_get_group_audience_fields()) {
// User entity doesn't have group audience fields. // User entity doesn't have group audience fields.
return; return $gids;
} }
$gids = array();
// Get all active OG membership that belong to the user. // Get all active OG membership that belong to the user.
$wrapper = entity_metadata_wrapper('user', $account->uid); $wrapper = entity_metadata_wrapper('user', $account->uid);
$og_memberships = $wrapper->{'og_membership__' . OG_STATE_ACTIVE}->value(); $og_memberships = $wrapper->{'og_membership__' . OG_STATE_ACTIVE}->value();
if (!$og_memberships) { if (!$og_memberships) {
return; return $gids;
} }
foreach ($og_memberships as $og_membership) { foreach ($og_memberships as $og_membership) {
......
...@@ -105,7 +105,6 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic { ...@@ -105,7 +105,6 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic {
$field_mode = $this->instance['field_mode']; $field_mode = $this->instance['field_mode'];
$user_groups = og_get_groups_by_user(NULL, $group_type); $user_groups = og_get_groups_by_user(NULL, $group_type);
$user_groups = $user_groups ? $user_groups : array();
$user_groups = array_merge($user_groups, $this->getGidsForCreate()); $user_groups = array_merge($user_groups, $this->getGidsForCreate());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment