[ticket/216] Add function for obtaining user's groups

B3P-216
This commit is contained in:
Marc Alexander
2012-12-07 00:59:57 +01:00
parent 326d9013b2
commit d5b91d4c01
4 changed files with 38 additions and 36 deletions

View File

@@ -181,17 +181,7 @@ class portal_calendar_module
}
array_multisort($time_ary, SORT_NUMERIC, $events);
// get user's groups
$sql = 'SELECT group_id
FROM ' . USER_GROUP_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$groups_ary[] = $row['group_id'];
}
$db->sql_freeresult($result);
$groups_ary = get_user_groups();
foreach($events as $key => $cur_event)
{

View File

@@ -69,18 +69,8 @@ class portal_links_module
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
// get user's groups
$sql = 'SELECT group_id
FROM ' . USER_GROUP_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$groups_ary[] = $row['group_id'];
}
$db->sql_freeresult($result);
$groups_ary = get_user_groups();
for ($i = 0; $i < sizeof($links); $i++)
{
if($links[$i]['type'] == self::LINK_INT)

View File

@@ -68,20 +68,10 @@ class portal_main_menu_module
$portal_config = obtain_portal_config();
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
// get user's groups
$sql = 'SELECT group_id
FROM ' . USER_GROUP_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$groups_ary[] = $row['group_id'];
}
$db->sql_freeresult($result);
$groups_ary = get_user_groups();
for ($i = 0; $i < sizeof($links); $i++)
{
if($links[$i]['type'] == self::LINK_CAT)