How To... Add Group Permissions to User Preferences

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

How To... Add Group Permissions to User Preferences

Post 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.
Last edited by Simon66 on Tue Jun 10, 2008 12:03 am, edited 1 time in total.
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

This must be Thursday. I never could get the hang of Thursdays.

Douglas Adams - The only sane person in the asylum.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “[locked] Installation, Setup and Upgrade”