summaryrefslogtreecommitdiff
path: root/classes/User_group.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/User_group.php')
-rw-r--r--classes/User_group.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/classes/User_group.php b/classes/User_group.php
index 64fe024b3..1a5ddf253 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -279,12 +279,26 @@ class User_group extends Memcached_DataObject
return true;
}
- static function getForNickname($nickname)
+ static function getForNickname($nickname, $profile=null)
{
$nickname = common_canonical_nickname($nickname);
- $group = User_group::staticGet('nickname', $nickname);
+
+ // Are there any matching remote groups this profile's in?
+ if ($profile) {
+ $group = $profile->getGroups();
+ while ($group->fetch()) {
+ if ($group->nickname == $nickname) {
+ // @fixme is this the best way?
+ return clone($group);
+ }
+ }
+ }
+
+ // If not, check local groups.
+
+ $group = Local_group::staticGet('nickname', $nickname);
if (!empty($group)) {
- return $group;
+ return User_group::staticGet('id', $group->group_id);
}
$alias = Group_alias::staticGet('alias', $nickname);
if (!empty($alias)) {