Пример #1
0
function MembergroupMembers()
{
    global $txt, $scripturl, $db_prefix, $context, $modSettings, $sourcedir, $func;
    $_REQUEST['group'] = (int) $_REQUEST['group'];
    // No browsing of guests, membergroup 0 or moderators.
    if (in_array($_REQUEST['group'], array(-1, 0, 3))) {
        fatal_lang_error('membergroup_does_not_exist', false);
    }
    // Load up the group details - and ensure this ISN'T a post group ;)
    $request = db_query("\n\t\tSELECT ID_GROUP AS id, groupName AS name, minPosts = -1 AS assignable, minPosts != -1 AS is_post_group\n\t\tFROM {$db_prefix}membergroups\n\t\tWHERE ID_GROUP = " . (int) $_REQUEST['group'] . "\n\t\tLIMIT 1", __FILE__, __LINE__);
    // Not really possible...
    if (mysql_num_rows($request) == 0) {
        fatal_lang_error('membergroup_does_not_exist', false);
    }
    $context['group'] = mysql_fetch_assoc($request);
    mysql_free_result($request);
    // Non-admins cannot assign admins.
    if ($context['group']['id'] == 1 && !allowedTo('admin_forum')) {
        $context['group']['assignable'] = 0;
    }
    // Removing member from group?
    if (isset($_POST['remove']) && !empty($_REQUEST['rem']) && is_array($_REQUEST['rem']) && $context['group']['assignable']) {
        checkSession();
        require_once $sourcedir . '/Subs-Members.php';
        removeMembersFromGroups($_REQUEST['rem'], $_REQUEST['group']);
    } elseif (isset($_REQUEST['add']) && !empty($_REQUEST['toAdd']) && $context['group']['assignable']) {
        checkSession();
        // Get all the members to be added... taking into account names can be quoted ;)
        $_REQUEST['toAdd'] = strtr(addslashes($func['htmlspecialchars'](stripslashes($_REQUEST['toAdd']), ENT_QUOTES)), array('"' => '"'));
        preg_match_all('~"([^"]+)"~', $_REQUEST['toAdd'], $matches);
        $memberNames = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_REQUEST['toAdd']))));
        foreach ($memberNames as $index => $memberName) {
            $memberNames[$index] = trim($func['strtolower']($memberNames[$index]));
            if (strlen($memberNames[$index]) == 0) {
                unset($memberNames[$index]);
            }
        }
        $request = db_query("\n\t\t\tSELECT ID_MEMBER\n\t\t\tFROM {$db_prefix}members\n\t\t\tWHERE LOWER(memberName) IN ('" . implode("', '", $memberNames) . "') OR LOWER(realName) IN ('" . implode("', '", $memberNames) . "')\n\t\t\tLIMIT " . count($memberNames), __FILE__, __LINE__);
        $members = array();
        while ($row = mysql_fetch_assoc($request)) {
            $members[] = $row['ID_MEMBER'];
        }
        mysql_free_result($request);
        // !!! Add $_POST['additional'] to templates!
        // Do the updates...
        require_once $sourcedir . '/Subs-Members.php';
        addMembersToGroup($members, $_REQUEST['group'], isset($_POST['additional']) ? 'only_additional' : 'auto');
    }
    // Sort out the sorting!
    $sort_methods = array('name' => 'realName', 'email' => 'emailAddress', 'active' => 'lastLogin', 'registered' => 'dateRegistered', 'posts' => 'posts');
    // They didn't pick one, default to by name..
    if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = 'name';
        $querySort = 'realName';
    } else {
        $context['sort_by'] = $_REQUEST['sort'];
        $querySort = $sort_methods[$_REQUEST['sort']];
    }
    $context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up';
    // Count members of the group.
    $request = db_query("\n\t\tSELECT COUNT(*)\n\t\tFROM {$db_prefix}members\n\t\tWHERE " . (empty($context['group']['is_post_group']) ? "ID_GROUP = " . (int) $_REQUEST['group'] . " OR FIND_IN_SET(" . (int) $_REQUEST['group'] . ", additionalGroups)" : "ID_POST_GROUP = " . (int) $_REQUEST['group']), __FILE__, __LINE__);
    list($context['total_members']) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Create the page index.
    $context['page_index'] = constructPageIndex($scripturl . '?action=membergroups;sa=members;group=' . $_REQUEST['group'] . ';sort=' . $context['sort_by'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $context['total_members'], $modSettings['defaultMaxMembers']);
    $context['start'] = $_REQUEST['start'];
    // Load up all members of this group.
    $request = db_query("\n\t\tSELECT ID_MEMBER, memberName, realName, emailAddress, memberIP, dateRegistered, lastLogin, posts, is_activated\n\t\tFROM {$db_prefix}members\n\t\tWHERE " . (empty($context['group']['is_post_group']) ? "ID_GROUP = " . (int) $_REQUEST['group'] . " OR FIND_IN_SET(" . (int) $_REQUEST['group'] . ", additionalGroups)" : "ID_POST_GROUP = " . (int) $_REQUEST['group']) . "\n\t\tORDER BY {$querySort} " . ($context['sort_direction'] == 'down' ? 'DESC' : 'ASC') . "\n\t\tLIMIT {$context['start']}, {$modSettings['defaultMaxMembers']}", __FILE__, __LINE__);
    $context['members'] = array();
    while ($row = mysql_fetch_assoc($request)) {
        $last_online = empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']);
        // Italicize the online note if they aren't activated.
        if ($row['is_activated'] % 10 != 1) {
            $last_online = '<i title="' . $txt['not_activated'] . '">' . $last_online . '</i>';
        }
        $context['members'][] = array('id' => $row['ID_MEMBER'], 'name' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>', 'email' => '<a href="mailto:' . $row['emailAddress'] . '">' . $row['emailAddress'] . '</a>', 'ip' => '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['memberIP'] . '">' . $row['memberIP'] . '</a>', 'registered' => timeformat($row['dateRegistered']), 'last_online' => $last_online, 'posts' => $row['posts'], 'is_activated' => $row['is_activated'] % 10 == 1);
    }
    mysql_free_result($request);
    // Select the template.
    $context['sub_template'] = 'group_members';
    $context['page_title'] = $txt['membergroups_members_title'] . ': ' . $context['group']['name'];
}
Пример #2
0
function MembergroupMembers()
{
    global $txt, $scripturl, $context, $modSettings, $sourcedir, $user_info, $settings, $smcFunc;
    $_REQUEST['group'] = isset($_REQUEST['group']) ? (int) $_REQUEST['group'] : 0;
    // No browsing of guests, membergroup 0 or moderators.
    if (in_array($_REQUEST['group'], array(-1, 0, 3))) {
        fatal_lang_error('membergroup_does_not_exist', false);
    }
    // Load up the group details.
    $request = $smcFunc['db_query']('', '
		SELECT id_group AS id, group_name AS name, CASE WHEN min_posts = {int:min_posts} THEN 1 ELSE 0 END AS assignable, hidden, online_color,
			stars, description, CASE WHEN min_posts != {int:min_posts} THEN 1 ELSE 0 END AS is_post_group
		FROM {db_prefix}membergroups
		WHERE id_group = {int:id_group}
		LIMIT 1', array('min_posts' => -1, 'id_group' => $_REQUEST['group']));
    // Doesn't exist?
    if ($smcFunc['db_num_rows']($request) == 0) {
        fatal_lang_error('membergroup_does_not_exist', false);
    }
    $context['group'] = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Fix the stars.
    $context['group']['stars'] = explode('#', $context['group']['stars']);
    $context['group']['stars'] = !empty($context['group']['stars'][0]) && !empty($context['group']['stars'][1]) ? str_repeat('<img src="' . $settings['images_url'] . '/' . $context['group']['stars'][1] . '" alt="*" border="0" />', $context['group']['stars'][0]) : '';
    $context['group']['can_moderate'] = allowedTo('manage_membergroups');
    $context['linktree'][] = array('url' => $scripturl . '?action=groups;sa=members;group=' . $context['group']['id'], 'name' => $context['group']['name']);
    // Load all the group moderators, for fun.
    $request = $smcFunc['db_query']('', '
		SELECT mem.id_member, mem.real_name
		FROM {db_prefix}group_moderators AS mods
			INNER JOIN {db_prefix}members AS mem ON (mem.id_member = mods.id_member)
		WHERE mods.id_group = {int:id_group}', array('id_group' => $_REQUEST['group']));
    $context['group']['moderators'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        $context['group']['moderators'][] = array('id' => $row['id_member'], 'name' => $row['real_name']);
        if ($user_info['id'] == $row['id_member']) {
            $context['group']['can_moderate'] = true;
        }
    }
    $smcFunc['db_free_result']($request);
    // If this group is hidden then it can only "exists" if the user can moderate it!
    if ($context['group']['hidden'] && !$context['group']['can_moderate']) {
        fatal_lang_error('membergroup_does_not_exist', false);
    }
    // You can only assign membership if you are the moderator and/or can manage groups!
    if (!$context['group']['can_moderate']) {
        $context['group']['assignable'] = 0;
    } elseif ($context['group']['id'] == 1 && !allowedTo('admin_forum')) {
        $context['group']['assignable'] = 0;
    }
    // Removing member from group?
    if (isset($_POST['remove']) && !empty($_REQUEST['rem']) && is_array($_REQUEST['rem']) && $context['group']['assignable']) {
        checkSession();
        // Make sure we're dealing with integers only.
        foreach ($_REQUEST['rem'] as $key => $group) {
            $_REQUEST['rem'][$key] = (int) $group;
        }
        require_once $sourcedir . '/Subs-Membergroups.php';
        removeMembersFromGroups($_REQUEST['rem'], $_REQUEST['group'], true);
    } elseif (isset($_REQUEST['add']) && (!empty($_REQUEST['toAdd']) || !empty($_REQUEST['member_add'])) && $context['group']['assignable']) {
        checkSession();
        $member_query = array();
        $member_parameters = array();
        // Get all the members to be added... taking into account names can be quoted ;)
        $_REQUEST['toAdd'] = strtr($smcFunc['htmlspecialchars']($_REQUEST['toAdd'], ENT_QUOTES), array('&quot;' => '"'));
        preg_match_all('~"([^"]+)"~', $_REQUEST['toAdd'], $matches);
        $member_names = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_REQUEST['toAdd']))));
        foreach ($member_names as $index => $member_name) {
            $member_names[$index] = trim($smcFunc['strtolower']($member_names[$index]));
            if (strlen($member_names[$index]) == 0) {
                unset($member_names[$index]);
            }
        }
        // Any passed by ID?
        $member_ids = array();
        if (!empty($_REQUEST['member_add'])) {
            foreach ($_REQUEST['member_add'] as $id) {
                if ($id > 0) {
                    $member_ids[] = (int) $id;
                }
            }
        }
        // Construct the query pelements.
        if (!empty($member_ids)) {
            $member_query[] = 'id_member IN ({array_int:member_ids})';
            $member_parameters['member_ids'] = $member_ids;
        }
        if (!empty($member_names)) {
            $member_query[] = 'LOWER(member_name) IN ({array_string:member_names})';
            $member_query[] = 'LOWER(real_name) IN ({array_string:member_names})';
            $member_parameters['member_names'] = $member_names;
        }
        $members = array();
        if (!empty($member_query)) {
            $request = $smcFunc['db_query']('', '
				SELECT id_member
				FROM {db_prefix}members
				WHERE (' . implode(' OR ', $member_query) . ')
					AND id_group != {int:id_group}
					AND FIND_IN_SET({int:id_group}, additional_groups) = 0', array_merge($member_parameters, array('id_group' => $_REQUEST['group'])));
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                $members[] = $row['id_member'];
            }
            $smcFunc['db_free_result']($request);
        }
        // !!! Add $_POST['additional'] to templates!
        // Do the updates...
        if (!empty($members)) {
            require_once $sourcedir . '/Subs-Membergroups.php';
            addMembersToGroup($members, $_REQUEST['group'], isset($_POST['additional']) || $context['group']['hidden'] ? 'only_additional' : 'auto', true);
        }
    }
    // Sort out the sorting!
    $sort_methods = array('name' => 'real_name', 'email' => allowedTo('moderate_forum') ? 'email_address' : 'hide_email ' . (isset($_REQUEST['desc']) ? 'DESC' : 'ASC') . ', email_address', 'active' => 'last_login', 'registered' => 'date_registered', 'posts' => 'posts');
    // They didn't pick one, default to by name..
    if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = 'name';
        $querySort = 'real_name';
    } else {
        $context['sort_by'] = $_REQUEST['sort'];
        $querySort = $sort_methods[$_REQUEST['sort']];
    }
    $context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up';
    // The where on the query is interesting. Non-moderators should only see people who are in this group as primary.
    if ($context['group']['can_moderate']) {
        $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group} OR FIND_IN_SET({int:group}, additional_groups) != 0';
    } else {
        $where = $context['group']['is_post_group'] ? 'id_post_group = {int:group}' : 'id_group = {int:group}';
    }
    // Count members of the group.
    $request = $smcFunc['db_query']('', '
		SELECT COUNT(*)
		FROM {db_prefix}members
		WHERE ' . $where, array('group' => $_REQUEST['group']));
    list($context['total_members']) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    $context['total_members'] = comma_format($context['total_members']);
    // Create the page index.
    $context['page_index'] = constructPageIndex($scripturl . '?action=' . ($context['group']['can_moderate'] ? 'moderate;area=viewgroups' : 'groups') . ';sa=members;group=' . $_REQUEST['group'] . ';sort=' . $context['sort_by'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $context['total_members'], $modSettings['defaultMaxMembers']);
    $context['start'] = $_REQUEST['start'];
    $context['can_moderate_forum'] = allowedTo('moderate_forum');
    // Load up all members of this group.
    $request = $smcFunc['db_query']('', '
		SELECT id_member, member_name, real_name, email_address, member_ip, date_registered, last_login,
			hide_email, posts, is_activated, real_name
		FROM {db_prefix}members
		WHERE ' . $where . '
		ORDER BY ' . $querySort . ' ' . ($context['sort_direction'] == 'down' ? 'DESC' : 'ASC') . '
		LIMIT ' . $context['start'] . ', ' . $modSettings['defaultMaxMembers'], array('group' => $_REQUEST['group']));
    $context['members'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $last_online = empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']);
        // Italicize the online note if they aren't activated.
        if ($row['is_activated'] % 10 != 1) {
            $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>';
        }
        if (!empty($row['id_member'])) {
            $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        }
        $context['members'][] = array('id' => $row['id_member'], 'name' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', 'email' => $row['email_address'], 'show_email' => showEmailAddress(!empty($row['hide_email']), $row['id_member']), 'ip' => '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['member_ip'] . '">' . $row['member_ip'] . '</a>', 'registered' => timeformat($row['date_registered']), 'last_online' => $last_online, 'posts' => comma_format($row['posts']), 'is_activated' => $row['is_activated'] % 10 == 1);
    }
    $smcFunc['db_free_result']($request);
    //Color the Groups List ;D
    if (!empty($modSettings['MemberColorModCenter']) && !empty($context['MemberColor_ID_MEMBER'])) {
        $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
        if (!empty($context['group']['moderators'])) {
            foreach ($context['group']['moderators'] as $key => $item) {
                if (!empty($colorDatas[$item['id']]['colored_link'])) {
                    $context['group']['moderators'][$key]['name'] = $colorDatas[$item['id']]['colored_name'];
                }
            }
        }
        if (!empty($context['members'])) {
            foreach ($context['members'] as $key => $item) {
                if (!empty($colorDatas[$item['id']]['colored_link'])) {
                    $context['members'][$key]['name'] = $colorDatas[$item['id']]['colored_link'];
                }
            }
        }
    }
    // Select the template.
    $context['sub_template'] = 'group_members';
    $context['page_title'] = $txt['membergroups_members_title'] . ': ' . $context['group']['name'];
}
Пример #3
0
 /**
  * Display members of a group, and allow adding of members to a group.
  *
  * What it does:
  * - It can be called from ManageMembergroups if it needs templating within the admin environment.
  * - It shows a list of members that are part of a given membergroup.
  * - It is called by ?action=moderate;area=viewgroups;sa=members;group=x
  * - It requires the manage_membergroups permission.
  * - It allows to add and remove members from the selected membergroup.
  * - It allows sorting on several columns.
  * - It redirects to itself.
  * @uses ManageMembergroups template, group_members sub template.
  */
 public function action_members()
 {
     global $txt, $scripturl, $context, $modSettings, $user_info, $settings;
     $current_group = isset($_REQUEST['group']) ? (int) $_REQUEST['group'] : 0;
     // These will be needed
     require_once SUBSDIR . '/Membergroups.subs.php';
     require_once SUBSDIR . '/Members.subs.php';
     // Load up the group details.
     $context['group'] = membergroupById($current_group, true, true);
     // No browsing of guests, membergroup 0 or moderators or non-existing groups.
     if ($context['group'] === false || in_array($current_group, array(-1, 0, 3))) {
         fatal_lang_error('membergroup_does_not_exist', false);
     }
     $context['group']['id'] = $context['group']['id_group'];
     $context['group']['name'] = $context['group']['group_name'];
     // Fix the membergroup icons.
     $context['group']['icons'] = explode('#', $context['group']['icons']);
     $context['group']['icons'] = !empty($context['group']['icons'][0]) && !empty($context['group']['icons'][1]) ? str_repeat('<img src="' . $settings['images_url'] . '/group_icons/' . $context['group']['icons'][1] . '" alt="*" />', $context['group']['icons'][0]) : '';
     $context['group']['can_moderate'] = allowedTo('manage_membergroups') && (allowedTo('admin_forum') || $context['group']['group_type'] != 1);
     // The template is very needy
     $context['linktree'][] = array('url' => $scripturl . '?action=groups;sa=members;group=' . $context['group']['id'], 'name' => $context['group']['name']);
     $context['can_send_email'] = allowedTo('send_email_to_members');
     $context['sort_direction'] = isset($_REQUEST['desc']) ? 'down' : 'up';
     $context['start'] = $_REQUEST['start'];
     $context['can_moderate_forum'] = allowedTo('moderate_forum');
     // @todo: use createList
     // Load all the group moderators, for fun.
     $context['group']['moderators'] = array();
     $moderators = getGroupModerators($current_group);
     foreach ($moderators as $id_member => $name) {
         $context['group']['moderators'][] = array('id' => $id_member, 'name' => $name);
         if ($user_info['id'] == $id_member && $context['group']['group_type'] != 1) {
             $context['group']['can_moderate'] = true;
         }
     }
     // If this group is hidden then it can only "exist" if the user can moderate it!
     if ($context['group']['hidden'] && !$context['group']['can_moderate']) {
         fatal_lang_error('membergroup_does_not_exist', false);
     }
     // You can only assign membership if you are the moderator and/or can manage groups!
     if (!$context['group']['can_moderate']) {
         $context['group']['assignable'] = 0;
     } elseif ($context['group']['id'] == 1 && !allowedTo('admin_forum')) {
         $context['group']['assignable'] = 0;
     }
     // Removing member from group?
     if (isset($_POST['remove']) && !empty($_REQUEST['rem']) && is_array($_REQUEST['rem']) && $context['group']['assignable']) {
         // Security first
         checkSession();
         validateToken('mod-mgm');
         // Make sure we're dealing with integers only.
         foreach ($_REQUEST['rem'] as $key => $group) {
             $_REQUEST['rem'][$key] = (int) $group;
         }
         removeMembersFromGroups($_REQUEST['rem'], $current_group, true);
     } elseif (isset($_REQUEST['add']) && (!empty($_REQUEST['toAdd']) || !empty($_REQUEST['member_add'])) && $context['group']['assignable']) {
         // Make sure you can do this
         checkSession();
         validateToken('mod-mgm');
         $member_query = array(array('and' => 'not_in_group'));
         $member_parameters = array('not_in_group' => $current_group);
         // Get all the members to be added... taking into account names can be quoted ;)
         $_REQUEST['toAdd'] = strtr(Util::htmlspecialchars($_REQUEST['toAdd'], ENT_QUOTES), array('&quot;' => '"'));
         preg_match_all('~"([^"]+)"~', $_REQUEST['toAdd'], $matches);
         $member_names = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_REQUEST['toAdd']))));
         foreach ($member_names as $index => $member_name) {
             $member_names[$index] = trim(Util::strtolower($member_names[$index]));
             if (strlen($member_names[$index]) == 0) {
                 unset($member_names[$index]);
             }
         }
         // Any members passed by ID?
         $member_ids = array();
         if (!empty($_REQUEST['member_add'])) {
             foreach ($_REQUEST['member_add'] as $id) {
                 if ($id > 0) {
                     $member_ids[] = (int) $id;
                 }
             }
         }
         // Construct the query pelements, first for adds by name
         if (!empty($member_ids)) {
             $member_query[] = array('or' => 'member_ids');
             $member_parameters['member_ids'] = $member_ids;
         }
         // And then adds by ID
         if (!empty($member_names)) {
             $member_query[] = array('or' => 'member_names');
             $member_parameters['member_names'] = $member_names;
         }
         // Get back the ones that were not already in the group
         $members = membersBy($member_query, $member_parameters);
         // Do the updates...
         if (!empty($members)) {
             addMembersToGroup($members, $current_group, $context['group']['hidden'] ? 'only_additional' : 'auto', true);
         }
     }
     // Sort out the sorting!
     $sort_methods = array('name' => 'real_name', 'email' => allowedTo('moderate_forum') ? 'email_address' : 'hide_email ' . (isset($_REQUEST['desc']) ? 'DESC' : 'ASC') . ', email_address', 'active' => 'last_login', 'registered' => 'date_registered', 'posts' => 'posts');
     // They didn't pick one, or tried a wrong one, so default to by name..
     if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
         $context['sort_by'] = 'name';
         $querySort = 'real_name' . (isset($_REQUEST['desc']) ? ' DESC' : ' ASC');
     } else {
         $context['sort_by'] = $_REQUEST['sort'];
         $querySort = $sort_methods[$_REQUEST['sort']] . (isset($_REQUEST['desc']) ? ' DESC' : ' ASC');
     }
     // The where on the query is interesting. Non-moderators should only see people who are in this group as primary.
     if ($context['group']['can_moderate']) {
         $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group';
     } else {
         $where = $context['group']['is_post_group'] ? 'in_post_group' : 'in_group_no_add';
     }
     // Count members of the group.
     $context['total_members'] = countMembersBy($where, array($where => $current_group));
     $context['total_members'] = comma_format($context['total_members']);
     // Create the page index.
     $context['page_index'] = constructPageIndex($scripturl . '?action=' . ($context['group']['can_moderate'] ? 'moderate;area=viewgroups' : 'groups') . ';sa=members;group=' . $current_group . ';sort=' . $context['sort_by'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $context['total_members'], $modSettings['defaultMaxMembers']);
     // Fetch the members that meet the where criteria
     $context['members'] = membersBy($where, array($where => $current_group, 'order' => $querySort), true);
     foreach ($context['members'] as $id => $row) {
         $last_online = empty($row['last_login']) ? $txt['never'] : standardTime($row['last_login']);
         // Italicize the online note if they aren't activated.
         if ($row['is_activated'] % 10 != 1) {
             $last_online = '<em title="' . $txt['not_activated'] . '">' . $last_online . '</em>';
         }
         $context['members'][$id] = array('id' => $row['id_member'], 'name' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>', 'email' => $row['email_address'], 'show_email' => showEmailAddress(!empty($row['hide_email']), $row['id_member']), 'ip' => '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['member_ip'] . '">' . $row['member_ip'] . '</a>', 'registered' => standardTime($row['date_registered']), 'last_online' => $last_online, 'posts' => comma_format($row['posts']), 'is_activated' => $row['is_activated'] % 10 == 1);
     }
     if (!empty($context['group']['assignable'])) {
         loadJavascriptFile('suggest.js', array('defer' => true));
     }
     // Select the template.
     $context['sub_template'] = 'group_members';
     $context['page_title'] = $txt['membergroups_members_title'] . ': ' . $context['group']['name'];
     createToken('mod-mgm');
 }