1 (edited by Mr Puto 2006-03-13 08:06)

Topic: Junior Administrators 1.0

##
##
##        Mod title:  Junior Administrators
##
##      Mod version:  1.0.5 
##   Works on PunBB:  1.2.3, 1.2.4 
##     Release date:  3-12-06 
##           Author:  Alex Capek - i.is.alex@hotmail.com
##
##      Description:  This modifications allows you to have Junior Administrators. They have the basic actions, can moderate all forums, have more access to the Admin ##Panel.
##
##       Affects DB:  Yes 
##
##   Affected files:  include/common.php, include/common_admin.php include/functions, all admin files except admin_prune.php, admin_reports.php, ##admin_loader.php(duh), dmin_index.php, admin_censoring.php, profile.php, viewforum.php, viewtopic.php, moderate.php
##
##            Notes: This is a rather large mod, it will drastically change your mysql database. I would say it is a VERY GOOD IDEA TO BACKUP before you install this mod.
##    You can configure which admin pages they can see in admin_options. If you allow J Admins to access the Admin Options page, they will not be able to ##configure themselves, only root admins will be able to.
##
##       DISCLAIMER:  Please note that 'mods' are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##

Download at PunRes

PLEASE LET ME KNOW IF THERE ARE ANY BUGS. Thanks.

2 (edited by snowman 2006-03-13 10:20)

Re: Junior Administrators 1.0

Critiques:
I don't like how you managed the new permissions. You've modified far too much hard code and put in too many logical statements to determine if the user is a Junior Admin, notoriously the following:

if ($pun_user['g_id'] > PUN_ADMIN && $pun_config['o_jadmins_pg#'] != '1')

I feel this is unnecessary.

Change #63 can be shortened:

if ($pun_user['g_id'] == PUN_JADMIN)
$jquery = "AND g_id!='.PUN_ADMIN.' AND g_id!='.PUN_JADMIN.' ";

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

Could use a lot more work, kind of sloppy given the professional nature of PunBB

Re: Junior Administrators 1.0

$db->query('UPDATE '.$db->prefix.'users SET group_id=group_id+1 WHERE group_id!=4 AND group_id!=1 ORDER BY group_id DESC')

You don't need the order_by here
And won't this mess up people who had a group ID of 4 (member) which is now 5?

Re: Junior Administrators 1.0

Then just change group_id!=4 to group_id>4 ...

Re: Junior Administrators 1.0

Thanks guys. and yeah it's definatley not the best work ever..but it works. I will be fixing up the code over the next week or so. Thanks.