Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-02-19 13:40:30
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
bot_admin_body_class
This micro-plugin let’s you hide items in txp backend based on the logged user name and privilege level, via css.
Once activated it simply adds two classes to the body tag of each tab via jquery:
- One indicates the user group of the current logged user
- Another indicates the logged user
For example if I log in as “Donald Swain” with “managing editor” privileges, the “body” tag for every txp admin page will now have two more classes: “managing_editor” and “donald_swain”.
Please note that the user name will be lowercased and spaces will be replaced with an underscore.
Privileges can be one of the following:
- publisher
- managing_editor
- copy_editor
- staff_writer
- freelancer
- designer
- none
Once done that, you can easily hide items in the admin adding some css rules in your textpattern.css file.
For example:
body.managing_editor .override-form {display:none;}
will hide the “override form” field for each user logged as managing editor.
In the same vein
body.donald_swain .override-form {display:none;}
Will do the same but only if you are logged in as Donald Swain.
The idea for this plugin comes from sacripant
Last edited by redbot (2011-02-27 16:24:29)
Offline
Offline
#3 2011-02-19 16:22:43
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: bot_admin_body_class
Gocom wrote:
Neat and simple. Great work redbot :-)
Thank you maestro
Offline
#4 2011-02-19 20:07:36
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: bot_admin_body_class
Very cool stuff! Again! Thanks, Luca!
And a »Nice idea!« to Sacripant!
@ all: Let me advertise the advent of the Paypal button on the site of a guy who deserves some of our virtual thankfulness :)
Last edited by uli (2011-02-19 20:11:50)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#5 2011-02-19 20:10:38
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: bot_admin_body_class
uli wrote:
Very cool stuff! Again! Thanks, Luca!
Thanks uli ;-)
Offline
Re: bot_admin_body_class
Perfect,
Small, but allows much.
I think I’ll always install by default.
Now there are css class, I suggest you do the splits :D
Merging with bwt_customize :
rearrange and style items in the write tab, hide them on a per section basis and remove sections from the “write” tab sections dropdown per group (and user ?)
It’s just another idea.
Offline
#7 2011-02-21 20:52:36
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: bot_admin_body_class
sacripant wrote:
…rearrange and style items in the write tab, hide them on a per section basis and remove sections from the “write” tab sections dropdown per group (and user ?)
Hi sacripant,
I fear this would be overly complicated and all in all not worthwhile.
I’ll split my answer:
… rearrange and style items
I think that’s not an issue. I can’t imagine a situation where you would need to rearrange items on a per-user basis (for example why you would move the ‘excerpt’ field before the ‘body’ field only for specific users?)
… hide them on a per section basis
Again, the two plugins can work perfectly together and cover all possible scenarios I can imagine.
….remove sections from the “write” tab sections dropdown per group (and user ?)
That’s the only case in which your request makes sense for me… but if you know a little jquery you can easily achieve it writing some custom rules in bot_wtc and taking advantage of the classes created by bot_body_class.
In case ask me how in the appropriate forum thread.
Offline
Re: bot_admin_body_class
Very interesting plugin, now we can specify a category or a section for dedicated user or group (adding some code to your plugin) that’s very cool!
Thanks redbot
Offline
Re: bot_admin_body_class
Again, the two plugins can work perfectly together and cover all possible scenarios I can imagine.
I agree. I am bridged
Just I remember, some users were asked if bwt_customise could hide sections for some users
One TxpTips could help users who do not know JavaScript or Jquery.
Offline
Re: bot_admin_body_class
What happens if a logged in user has JS switched off? Idle of me to ask, I know, when I could try it out myself.
Offline
#11 2011-02-27 20:08:36
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: bot_admin_body_class
joebaich wrote:
What happens if a logged in user has JS switched off? Idle of me to ask, I know, when I could try it out myself.
Hi Joe,
of course the plugin won’t work. This is a simple plugin which aims at providing a better user exeprience hiding fields which are not useful for some users. It’s not meant to grant user privileges.
P.S. the plugin won’t work even if css is turned off.
Offline
Re: bot_admin_body_class
Yes, I was really just thinking aloud. I have a user who knows how to disable JS in his browser and uses how well his website performs without it as a proxy measure of the efficiency of everything else (and the state of the universe). So glad he can’t disable the CSS.
A good bit of work though and, you are right, no reason why it can’t improve the experience for other users.
Last edited by joebaich (2011-02-27 22:39:49)
Offline