Mission accomplished!
This is only for situations where you do not want clients creating groups and messing with the site. It is a hack (only two files changed) but you will need to re-apply for future upgrades of Xoops.
* Create a new group, e.g. 'executives'.
* Give the group system admin rights for 'Groups' and 'Edit Users'.
* Add the following hacks (backup first of course).
This will enable member(s) of the executives group to:
* Create new users and change their groups via the 'Edit Users' screen.
It will prevent the executives group from:
* Changing the webmaster details or password.
* Moving the webmaster into another group and removing them from webmaster group.
* Creating a new group with system admin rights.
Lock the Webmaster (UID 1) detailsmodules/system/admin/users/users.php
Part 1) Add as the first entry in 'function updateUser($uid, $uname, $name.....'
// Peekays Lock Webmaster hack (part 1) ---------------------------
// modules/system/admin/users/users.php
// First entry in 'function updateUser($uid, $uname, $name.....'
if(in_array(XOOPS_GROUP_ADMIN, $groups)) {
global $xoopsUser;
$peekay = $xoopsUser->getVar('uid');
if ($peekay != 1) {
xoops_cp_header();
echo 'You cannot edit or add users to the webmaster account';
xoops_cp_footer();
exit();
}
}
// end pk mod -----------------------------------------------------
Part 2) Around line 232 look for:
array_push($groups, XOOPS_GROUP_ADMIN);
}
Add directly below this:
// Peekay's Lock Webmaster hack (part 2) ------------------------------------------------
// modules/system/admin/users/users.php
// Around line 232 (xoops 2.0.16) add directly below:
// array_push($groups, XOOPS_GROUP_ADMIN);
// }
if (in_array(XOOPS_GROUP_ADMIN, $oldgroups) && !(in_array(XOOPS_GROUP_ADMIN, $groups))) {
array_push($groups, XOOPS_GROUP_ADMIN);
}
// end pk mod ---------------------------------------------------------------------------
Lock access to Groups except for the Webmastermodules/system/admin/groups/groups.php
Add the following at the top of the page:
// Peekays lock groups hack ------------------------------
// modules/system/admin/groups/groups.php
// First entry on the page
$peekay = $xoopsUser->getVar('uid');
if ($peekay != 1) {
xoops_cp_header();
echo 'Only the webmaster can add or edit groups';
xoops_cp_footer();
exit();
}
// end pk mod --------------------------------------------
Please note: There is a bug in XOOPS 2.0.16 that prevents a NEW user from being added to a custom group when the user is first added in the 'Edit Users' screen. Once the user has been created, you must 'edit' the user details, select the appropriate groups, then save again.
Apparently, this issue is being addressed.
I agree this functionality would be better served via a module or system prefs. In the meantime I hope this is helpful. If you spot any errors or have any improvements, please post them here.
A thread is for life. Not just for Christmas.