Index: branches/5.2.x/core/units/users/users_item.php =================================================================== diff -u -N -r14596 -r14630 --- branches/5.2.x/core/units/users/users_item.php (.../users_item.php) (revision 14596) +++ branches/5.2.x/core/units/users/users_item.php (.../users_item.php) (revision 14630) @@ -1,6 +1,6 @@ Application->RecallVar('UserGroups'); - if($user_groups === false || $force_reload) - { + + if ( $user_groups === false || $force_reload ) { // primary group goes first - $sql = 'SELECT GroupId - FROM ' . TABLE_PREFIX . 'UserGroup - WHERE (PortalUserId = ' . $this->GetID() . ') AND ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) ) - ORDER BY IF(GroupId = ' . $this->GetDBField('PrimaryGroupId') . ', 1, 0) DESC'; + $sql = 'SELECT g.IPRestrictions, ug.GroupId + FROM ' . TABLE_PREFIX . 'UserGroup ug + JOIN ' . TABLE_PREFIX . 'PortalGroup g ON g.GroupId = ug.GroupId + WHERE (ug.PortalUserId = ' . $this->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'); - return $this->Conn->GetCol($sql); + if ( $this->Application->isDebugMode() ) { + return array_keys($groups); + } + else { + $user_groups = Array (); + + foreach ($groups as $group_id => $ip_restrictions) { + if ( !$ip_restrictions || kUtil::ipMatch($ip_restrictions, "\n") ) { + $user_groups[] = $group_id; + } + } + + return $user_groups; + } } - else - { - return explode(',', $user_groups); - } + + return explode(',', $user_groups); } function SendEmailEvents() @@ -142,7 +156,7 @@ if ( $ret ) { $sync_manager =& $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); /* @var $sync_manager UsersSyncronizeManager */ - + $sync_manager->performAction('deleteUser', $this->FieldValues); }