Index: branches/5.2.x/core/units/users/users_item.php =================================================================== diff -u -N -r14630 -r14631 --- branches/5.2.x/core/units/users/users_item.php (.../users_item.php) (revision 14630) +++ branches/5.2.x/core/units/users/users_item.php (.../users_item.php) (revision 14631) @@ -1,6 +1,6 @@ GetID() . ') AND ( (ug.MembershipExpires IS NULL) OR (ug.MembershipExpires >= ' . adodb_mktime() . ') ) - ORDER BY IF(ug.GroupId = ' . $this->GetDBField('PrimaryGroupId') . ', 1, 0) DESC'; - $groups = $this->Conn->GetCol($sql, 'GroupId'); + $sql = 'SELECT GroupId + FROM ' . TABLE_PREFIX . 'UserGroup + WHERE (PortalUserId = ' . $this->GetID() . ') AND ( (MembershipExpires IS NULL) OR (MembershipExpires >= ' . adodb_mktime() . ') ) + ORDER BY IF(GroupId = ' . $this->GetDBField('PrimaryGroupId') . ', 1, 0) DESC'; + $groups = $this->Conn->GetCol($sql); - if ( $this->Application->isDebugMode() ) { - return array_keys($groups); - } - else { - $user_groups = Array (); + $user_helper =& $this->Application->recallObject('UserHelper'); + /* @var $user_helper UserHelper */ - foreach ($groups as $group_id => $ip_restrictions) { - if ( !$ip_restrictions || kUtil::ipMatch($ip_restrictions, "\n") ) { - $user_groups[] = $group_id; - } - } + $user_groups = Array (); + $ip_restrictions = $user_helper->getGroupsWithIPRestrictions(); - return $user_groups; + foreach ($groups as $group_id) { + if ( !isset($ip_restrictions[$group_id]) || kUtil::ipMatch($ip_restrictions[$group_id], "\n") ) { + $user_groups[] = $group_id; + } } + + return $user_groups; } return explode(',', $user_groups);