Page 1 of 1

How To... Add Group Permissions to User Preferences

Posted: Mon Jun 09, 2008 11:20 am
by Simon66
I found a couple of people asking for this in old posts with no replies.
I also needed it, and figured out a solution. Here it is...

(this is based on v.1.3)
Step 1.
Open lib/classes/class.admintheme.inc.php and go to line 818.
You should find this:

Code: Select all

'description'=>lang('adminprefsdescription'),'show_in_menu'=>true),
Replace that with this:

Code: Select all

'description'=>lang('adminprefsdescription'),'show_in_menu'=>$this->HasPerm('myPrefPerms')),
Step 2.
Find line 356 and replace the closing curly bracket (whatever it's really called) with this:

Code: Select all

			
        # myprefs
		$this->perms['myPrefPerms'] = check_permission($this->userid, 'Modify User Preferences') |
                (isset($this->sectionCount['myprefs']) && $this->sectionCount['myprefs'] > 0);
				
    }
 
Step 3.
Find the 'cms_permissions_seq' table in the database (or 'permissions_seq' if you didn't choose a prefix)
Add 1 to whatever number is in it. (in my case 41 became 42)
Open table 'cms_permissions' and add a new line with the new number (in my case 42) as the permission_id.
Put 'Modify User Preferences' in the fields permission_name and permission_text and copy the create and modify dates from another row in the table.

You should now be able to see and set 'Modify User Preferences' on the Group Permissions page.

The downside is that all will be undone if you update in the future.
Good housekeeping tip - make a note in notepad of any files and DB tables you change and keep the txt file in the root of your site for future reference.

Hope it helps someone.
Simon66

There is no guarantee this doesn't break something else, but so-far it is working OK for me.

Re: How To... Add Group Permissions to User Preferences

Posted: Mon Jun 09, 2008 1:08 pm
by calguy1000
If you want this, the better solution for step 3 is:

a) Create a UDT like this:
    global $gCms;
    $cmsmailer =& $gCms->modules['CMSMailer']['object'];
    $cmsmailer->CreatePermission('Modify User Permissions','Modify User Permissions);

b) add that udt to a new dummy page

c) browse to that new dummy page

d) delete the new dummy page.