1 (edited by Tunox 2007-09-26 12:07)

Topic: Can Moderators change the group of a given user?

Hi guys

I have 5 groups in my punbb install:
Admin
Moderator
Group A
Group B
Visitors

By default all new members are set be part of the Group A.  I want to permit the moderator to be able to manually move  users to Group B. I checked the group preferences to see if I could give that right to the moderators but looks like this is possible only for admins. Is there any mod/plugin or code hack that would permit me do this ?

Thx in advance

Re: Can Moderators change the group of a given user?

I have it like that on my forum

http://test.phaxe.com/forum/

Login on Demo Account with these details

U: Demo
P: test

You are only allowed to change the "test" account details

3

Re: Can Moderators change the group of a given user?

Hi PhaxeNor

Thx for the reply. I'm trying to reach your website but I get either a timeout or a blank page when I sucessfully reach it. Although My connection is working fine, I'll test it again when I get home.
In the meantime do you mind explaining how you managed to get Mods change groups for a user? Was it a mod/plugin you've used, code hack, or a feature that is delivered by default with punBB and I'm totally blind and can't see it?

thx

4 (edited by PhaxeNor 2007-09-26 19:45)

Re: Can Moderators change the group of a given user?

Tunox wrote:

I'm trying to reach your website but I get either a timeout or a blank page when I sucessfully reach it. Although My connection is working fine, I'll test it again when I get home.

yea, they had some problems with one of the routers and mine was on that one sad

But I changed some stuff in the profile.php file

My Mods always have access to the Admin menu on profile (Not allowed to ban until im able to set up some temp ban option)


I just found the code that was for Admins to change group and pasted it in the MOD field and then I could see and select the groups.
But then I also had to to it so that they couldn't change to Admin, Mod or VIP but only Member and Donate


Find

if ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '1')

Above Add (change the group ids or what you feel like)

                        if ($pun_user['id'] != $id)
            {

?>    
            <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.' AND g_id!='.PUN_ADMIN.' AND g_id!='.PUN_MOD.' AND g_id!='.PUN_VIP.' 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>
                <?php

            }

Added this to the code

AND g_id!='.PUN_ADMIN.' AND g_id!='.PUN_MOD.' AND g_id!='.PUN_VIP.'

You can change this with what ever you feel like (recommend that ADMIN and MOD stay but VIP you can change to an group id or remove it.

Then I also made it so that MODS cant view and edit VIP profiles

Search for // View or edit? and you will find it.

if ($pun_user['id'] != $id &&
    ($pun_user['g_id'] > PUN_MOD ||
    ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') ||
    ($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST) ||
    ($pun_user['g_id'] == PUN_MOD && $user['g_id'] == PUN_VIP)))

Added an extra field under with VIP


I edited functions.php where the profile links are and made it so that the Mods can see that link even if the BAN option is set to No (0)


yea, forgot that I also changed it so that mods also are allowed to update group

5

Re: Can Moderators change the group of a given user?

PhaxeNor

Thx a lot mate for taking the time to write this down. I really appreciate it.

I'm going to make a fresh install and toy around. Just one question to make sure: all the code chunks have to be added to functions.php ?


Thx again

Re: Can Moderators change the group of a given user?

No, all the code in the code boxes are for profile.php only

in functions just search for profile.php or Essentials and you should find it

should be easy to find. Just remove the && $pun_config['p_mod_ban_users'] == '1' and all mods should be able to view the admin link