diff --git a/og.module b/og.module index b798ea1b22cc49deb4e67b44f14ab1dc46647508..13112f1ed82c58b346580d2722c0c6f258d740a8 100755 --- a/og.module +++ b/og.module @@ -3553,7 +3553,10 @@ function og_node_create_links($group_type, $gid, $field_name, $destination = NUL * types will be fetched. * * @return - * An array with the group IDs or an empty array. + * If $group_type is provided then an array of group IDs matching the + * specified group type. If $group_type is not provided then an associative + * array is returned containing arrays of group IDs keyed by group type. If + * no results are found an empty array is returned. */ function og_get_groups_by_user($account = NULL, $group_type = NULL) { if (empty($account)) { @@ -3581,12 +3584,10 @@ function og_get_groups_by_user($account = NULL, $group_type = NULL) { } } - if (empty($group_type)) { - return $gids; - } - elseif (!empty($gids[$group_type])) { - return $gids[$group_type]; + if (isset($group_type)) { + return isset($gids[$group_type]) ? $gids[$group_type] : array(); } + return $gids; } /**