Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2009-08-19 08:06:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

Re: customise the interface for certain admin users

candyman wrote:

Is there a plugin/method to show only certain forms in the override forms menu?

Not as far as I know. Couple of ideas:

  1. Can you just set the unwanted forms to be of any type other than ‘article’ so they won’t appear in the list?
  2. Can you wait a tiny bit for 4.2.0 to be released (or run an SVN copy right now) because this will be a lot easier to write as a plugin under the new TXP version

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Online

#17 2009-08-19 09:10:19

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: customise the interface for certain admin users

  1. I can’t…
  2. I can wait for 4.2.0

Offline

#18 2009-08-19 09:50:08

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: customise the interface for certain admin users

Bloke wrote:

Couple of ideas:

3. Give your forms a prefix like three undserscores so they line up below the necessary article forms and noticeably shifted to the right.
Furthermore you can create an empty divider menu item (form) named something like _DONT USE MENU ITEMS BELOW_____

Last edited by uli (2009-08-19 09:50:57)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#19 2009-08-19 10:35:16

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: customise the interface for certain admin users

candyman wrote:

Is there a plugin/method to show only certain forms in the override forms menu?

Hope I’m not missing something obvious but I think it can be doable with some jquery called form within a plugin. I do it regularly to hide some sections in the “section” select in the “article” tab.
If you don’t want to write a plugin I think there is already one (I can’t recall the name) which let’s you insert js code for the admin.

Offline

#20 2009-08-19 11:02:51

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: customise the interface for certain admin users

For the moment I’ll use Uli’s tip.

Offline

#21 2009-08-30 17:41:29

Gerich
Member
Registered: 2009-08-30
Posts: 35

Re: customise the interface for certain admin users

redbot wrote:

sthmtc
Hello, I know I’m a little to late but I hope you will read this. Is it still possible to have a look or download your plugin?
It would be a real time saver for me now (probably I could write it myself but my php skills are limited and I haven’t got so much time to experiment at the moment).
Thank you
ok solved, it was easier than I thought

I have the same question: Is it still possible to have a look or download this plugin? I need to hide a few sections in dropdown list from some users group.

Offline

#22 2009-08-30 18:20:58

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: customise the interface for certain admin users

Gerich wrote:

I need to hide a few sections in dropdown list from some users group.

If I understood correctly you want to hide sections only for certain users.
This could be done with a plugin but if you are in a hurry you could use sed_section_fields and modify this line in the code:

add_privs('sed_sf.static_sections', '1,2' );	# which users always see all sections in the write-tab select box 

(modify the numbers – in the above example sections are hidden for levels 3,4,5,6)

If sed_sections doesen’t work with txp 4.2.0 you can use my raw plugin bot_hide_per_section (is a sed_sections clone). In this case you’ll have to add a line under register_callback('bot_hide_per_section','article');
so it reads:

register_callback('bot_hide_per_section','article');
add_privs('bot_hide_per_section', '1,2,3,4,5,6');

(you have to modify the numbers according to your needs).

Hope this helps

Last edited by redbot (2009-08-30 18:35:53)

Offline

#23 2009-08-31 11:41:18

Gerich
Member
Registered: 2009-08-30
Posts: 35

Re: customise the interface for certain admin users

I have installed the plugin bot_hide_per_section, but it not work. This is my code:
register_callback(‘bot_hide_per_section’,‘article’);
add_privs(‘bot_hide_per_section’, ’1,2,3,4,6’);
and under:
// hidden sections in section list. Uncomment and replace.
$bot_hidden_sections=“sitemap,tools”;

But user “freelancer (5)” still can see in the sections dropdown list this sections:sitemap,tools. More precisely he can see all sections.
Maybe I did some wrong? Any idea?

Last edited by Gerich (2009-08-31 11:42:38)

Offline

#24 2009-08-31 12:14:18

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: customise the interface for certain admin users

Gerich wrote:

Maybe I did some wrong? Any idea?

Yes sorry you’re totally right. I forgot to tell you the important part :p

so, other than the mods you have already done you have to replace this piece of code:

function bot_hide_per_section(){ //  builds the script
	echo
		'<script language="javascript" type="text/javascript">'.n.
		'	$(document).ready(function() {'.n.
		'		$("#advanced").show();'.n.
		'		var value = $("select#section.list option:selected").val();';
				bot_fields_rows();
				bot_hide_sections();		
	echo
		'		$("select#section.list").change(function(){'.n;
					bot_fields_restore_rows();
	echo				
		'			var value = $("select#section.list").val();';
					bot_fields_rows();
	echo				
		'			}'.n.
		'		);'.n.				
		'	});'.n.
		'</script>'; 
}

with this:

function bot_hide_per_section(){ //  builds the script
if( has_privs('bot_hide_per_section') ){
	echo
		'<script language="javascript" type="text/javascript">'.n.
		'	$(document).ready(function() {'.n.
		'		$("#advanced").show();'.n.
		'		var value = $("select#section.list option:selected").val();';
				bot_fields_rows();
				bot_hide_sections();

echo ‘ $(“select#section.list”).change(function(){‘.n; bot_fields_restore_rows(); echo ‘ var value = $(“select#section.list”).val();’; bot_fields_rows(); echo ‘ }’.n. ‘ );’.n. ‘ });’.n. ‘</script>’;
}
}

Offline

#25 2009-08-31 21:57:09

Gerich
Member
Registered: 2009-08-30
Posts: 35

Re: customise the interface for certain admin users

I have made all as you have told, but unfortunately, nothing works. Could you show an example code how to hide some sections “name1,name2” (in dropdown list in Write tab) from users with the rights 5 for example?

Offline

#26 2009-08-31 23:56:18

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: customise the interface for certain admin users

Are you using txp 4.2.0?
I realized some hours ago that it ships with jquery 1.3.2 while txp 4.0.8 used v.1.2.6.
The code I posted works with jquery 1.2.6.
You have two alternatives now (if you’re using txp 4.2.0 as I believe):
1) replace jquery.js (under yoursite/textpattern) with jquery version 1.2.6
2) wait till I find what’s the problem and fix it (I hope soon)

Offline

#27 2009-09-01 09:25:23

Gerich
Member
Registered: 2009-08-30
Posts: 35

Re: customise the interface for certain admin users

redbot wrote:

Are you using txp 4.2.0?
I realized some hours ago that it ships with jquery 1.3.2 while txp 4.0.8 used v.1.2.6.
The code I posted works with jquery 1.2.6.
You have two alternatives now (if you’re using txp 4.2.0 as I believe):
1) replace jquery.js (under yoursite/textpattern) with jquery version 1.2.6
2) wait till I find what’s the problem and fix it (I hope soon)

Yes, I’m using txp 4.2.0.
I have replaced jquery with 1.2.6, but it didn’t take’s effect on your plugin. At last it take’s effect on plugin rah_section_titles, that didn’t work with jquery 1.3.2 too.

I shall wait, when you and other plugin authors will make them compatible to the new version of txp.

Offline

#28 2009-09-01 10:04:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

Re: customise the interface for certain admin users

I have written a tiny plugin specifically for 4.2.0 that hides sections from groups of users (it does it per privilege level). It removes sections from the dropdown list on the Write tab. Since rah_section_titles overrides the choices you make in this plugin I also made it possible to choose names or titles.

But it’s not pretty. You hard-code the section lists at the top of the plugin, you have to choose names/titles by editing the plugin, and if you want to also remove articles from those sections in the Article List, it requires a one-line core hack (at the moment).

Also, if you run rah_section_titles, sed_section_fields or adi_menu, the plugin won’t work unless those plugins are removed/patched. I’ve patched the latter two, although sed_sf should really be rewritten to take advantage of the new 4.2.0 features and make it play nicer with other plugins.

What this boils down to is that it’s a little early for this kind of functionality because of all the dependencies and older plugins that have yet to be updated. I won’t release my plugin in its current form because it’s embarrassingly neanderthal — though somehow elegant (and minuscule) in its implementation thanks to the shiny new UI callbacks.

But if anybody wants any specific functionality from this plugin for the time being, ask and I’ll post bits of the code here so you can try it yourselves — with no support/warranty implied of course ;-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Online

#29 2009-09-01 13:16:32

Gerich
Member
Registered: 2009-08-30
Posts: 35

Re: customise the interface for certain admin users

Bloke,
yes, I want to test your plugin, which can make these things. It’s exactly what I need.

Offline

#30 2009-09-01 13:18:21

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: customise the interface for certain admin users

Gerich wrote:

I have replaced jquery with 1.2.6, but it didn’t take’s effect on your plugin. At last it take’s effect on plugin rah_section_titles, that didn’t work with jquery 1.3.2 too.

Strange. It works for me. Have you tried disabling temporarily rah_section_titles?
As Bloke said before, the two plugins are probably interfering.
If disabling rah_section_titles works it should be easy for me to post here a modified version of my plugin which makes the two work together.

Oops! Bloke was faster (and for sure is far more reliable than me ;)).

Last edited by redbot (2009-09-01 13:32:33)

Offline

Board footer

Powered by FluxBB