Re: Adding new user group? Well here is a hack that I did for 4.5.1. I took the ALG Hack and made it work. I offer no guarantees, but it seems to work for me. Essentially I wanted to add a new group called 'Members' to my site. We have members who pay a monthly fee and I wanted to allow them to see hidden content like a Users Menu. It is also an eCommerce site, so any user that checks out becomes a registered user. Therefore I could not set the hidden members content to registered. Here is what I did.
I grabbed the ALG Hack, but soon realized that it did not quite fully work. It required some adaptations.
Run the following SQL statements
mos_groups.sql from ALG Hack – this recreates mos_groups table. I added 'Members' to this SQL.
DROP TABLE IF EXISTS `mos_groups`;
CREATE TABLE `mos_groups` (
`id` tinyint(3) unsigned NOT NULL default '0',
`name` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
INSERT INTO `mos_groups` (`id`,`name`) VALUES
(0,'Public'),(1,'Registered'),(2,'Member'),(3,'Spe cial'),(4,'Author'),(5,'Editor'),(6,'Publisher'),( 7,'Manager'),(8,'Administrator'),(9,'Super Administrator');
Now I need to adda a new level to the mos_core_acl_aro_groups table, because my new group does not show when I edit a user. I simply did an insert to add the Member group to the parent group 'Public Frontend'. This shows the Member for editing users.
INSERT INTO mos_core_acl_aro_groups
(parent_id,name,lft,rgt)
VALUES(29,'Member',4,11)
I updated the following files:
Update includes/mambo.php - notice the new group name 'Member'. The $row->gid matches with the mos_groups record.
/* added ALG Hack */
//Registered
$row->gid = 1;
// Member
if ($grp->name == "Member") {$row->gid = 2;}
// Special
if ($grp->name == "Special") {$row->gid = 3;}
// Author
if ($grp->name == "Author") {$row->gid = 4;}
// Editor
if ($grp->name == "Editor") {$row->gid = 5;}
// Publisher
if ($grp->name == "Publisher") {$row->gid = 6;}
// Manager
if ($grp->name == "Manager") {$row->gid = 7;}
// Administrator
if ($grp->name == "Administrator") {$row->gid = 8;}
// Super Administrator
if ($grp->name == "Super Administrator") {$row->gid = 9;}
/* removed per ALG Hack
if ($acl->is_group_child_of( $grp->name, 'Registered', 'ARO' ) ||
$acl->is_group_child_of( $grp->name, 'Administrator', 'ARO' )) {
// fudge Authors, Editors, Publishers and Super Administrators into the Special Group
$row->gid = 2;
}*/
/* End of Alg Hack */
I updated the following files in in administrator/components/
Update com_modules/admin.modules.php. Updated accessmenu to include new $access value for members Changes values to reflect. Notice the new access member level.
switch ( $access ) {
case 'accesspublic':
$access = 0;
break;
case 'accessregistered':
$access = 1;
break;
case 'accessmember':
$access = 2;
break;
case 'accessspecial':
$access = 3;
break;
}
Update com_modules/admin.modules.html.php. Updated access column to include new $row->access values. Notice the new accessmember level.
/* Updated per ALG Hack - added new access value */
if ( !$row->access ) {
$color_access = 'style="color: green;"';
$task_access = 'accessregistered';
} else if ( $row->access == 1 ) {
$color_access = 'style="color: red;"';
$task_access = 'accessmember';
} else if ( $row->access == 2 ) {
$color_access = 'style="color: blue;"';
$task_access = 'accessspecial';
} else if ( $row->access == 3 ) {
$color_access = 'style="color: violet;"';
$task_access = 'accesspublic';
} else {
$color_access = 'style="color: black;"';
$task_access = 'accesspublic';
}
Then I opened up Modules and set permissions to all modules that I wanted Members to see. I set these so that the Access was 'Member'. Next I edited all users that are members, using the User Manager, and set their group to 'Member'. Finally, I tried it out on the public site and it works! How cool is that! |