1 (edited by svo 2007-04-04 01:41)

Topic: Allow Moderators change users group

Hi,

this change allow moderators change the group of any user. Moderators cannot change others moderators.

profile.php
line 448 delete the line:

 if ($pun_user['g_id'] > PUN_ADMIN)

and put this:

 if ($pun_user['g_id'] > PUN_MOD)

In line 1501 search this segment:

<?php

        if ($pun_user['g_id'] == PUN_MOD)
        {

?>
                        <legend><?php echo $lang_profile['Delete ban legend'] ?></legend>
                        <div class="infldset">
                            <p><input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" /></p>
                        </div>
                    </fieldset>
                </div>

and below add this:

                <div class="inform">
                    <fieldset                        
                        <legend><?php echo $lang_profile['Group membership legend'] ?></legend>
                        <div class="infldset">
                            <select id="group_id" name="group_id">
<?php

                $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' && g_id!='.PUN_ADMIN.' && g_id!='.PUN_MOD.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());

                while ($cur_group = $db->fetch_assoc($result))
                {
                    if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == ''))
                        echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
                    else
                        echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
                }

?>
                            </select>
                            <input type="submit" name="update_group_membership" value="<?php echo $lang_profile['Save'] ?>" />
                        </div>
                    </fieldset>
                </div>
                <div class="inform">
                    <fieldset>

that's all.