<![CDATA[ How could i hide the TV's of my inherited documents from single manager users? - My Forums]]> https://forums.modx.com/thread/?thread=18118 <![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99236 lokust Jul 04, 2011, 09:08 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99236 <![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99235 do we have that we can use to control what is displayed
or not in MM?]]>
charliez Feb 16, 2010, 09:18 PM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99235
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99234
In my case, I wanted to hide a tv called ’image’ for everything apart from the child resources (28-34).

Grandparent2
Parent15
Child28
Child29
Child30
Parent16
Child31
Child32
Parent17
Child33
Child34

This worked for me:

switch($content['parent']) {
	case !15:
	case !16:
	case !17:
	case 2:
    	mm_hideFields('image','!1');
    	break;
  	default:
    	null;
    	break;
}


Although I found I also needed to explicitly refer to the grandparent to make sure it the tv was hidden for the parents too.

Hope it might be of use to someone else.]]>
dan_s8 Feb 10, 2010, 04:37 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99234
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99233
switch($content['parent']) {
	case 28:
	case 29:
    	mm_hideFields('tvname','2');
    	break;
  	default:
    	null;
    	break;
}


But my PHP isn’t great, so I don’t know about ’if parent != 28 or 29’.

Sorry!! Hopefully someone else might be able to show us what I expect is an easy fix!]]>
dan_s8 Feb 09, 2010, 11:03 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99233
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99232
if(($content['parent'] != 28) || ($content['parent'] != 29)) {
    mm_hideFields('tvname','2');
}


parent 28
child 1
child 2
parent 29
child 3
child 4]]>
pmorawski Jan 21, 2010, 10:00 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99232
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager user]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99231 Quote from: smashingred at Oct 13, 2009, 07:21 PM

You can use PHP in your mm_rules chunk too.

Supercool! I never noticed those global variable assignments before loading rules.

Here is another ManagerManager example rule you could define:

//<?php
if (!empty($content['id'])) { // editing resource
  mm_hideFields("alias", $user_role);
} else { // inserting new resource
  ...
}
]]>
danilocuculic Nov 04, 2009, 10:17 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99231
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager user]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99230 Quote from: smashingred at Oct 13, 2009, 07:21 PM

You can use PHP in your mm_rules chunk too. So you can do things like

<?php //only to turn on highlighting

// Hides the field tvname for all docs whose parent isn't id 28.
if($content['parent'] != 28){
    mm_hideFields('tvname','2');
}


You could similarly apply rules if a user id or role was a particular value. Adding PHP to the mix you have little you can’t do given you think out the way to conditionally apply showing or hiding.

Thank you!! laugh]]>
ysera Oct 14, 2009, 06:42 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99230
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager user]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99229
<?php //only to turn on highlighting

// Hides the field tvname for all docs whose parent isn't id 28.
if($content['parent'] != 28){
    mm_hideFields('tvname','2');
}


You could similarly apply rules if a user id or role was a particular value. Adding PHP to the mix you have little you can’t do given you think out the way to conditionally apply showing or hiding.]]>
smashingred Oct 13, 2009, 02:21 PM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99229
<![CDATA[Re: How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99228 Quote from: ysera at Oct 13, 2009, 04:44 PM

Would be better, just unfortunately the container and the inherited resources are using the same template, that’s why the same ID. So i could get the same by using the option I.

Assign different template to containers, then hide descendant’s TVs with option II.]]>
danilocuculic Oct 13, 2009, 02:07 PM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99228
<![CDATA[How could i hide the TV's of my inherited documents from single manager users?]]> https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99227
I’d like to answer the question above with MODx, and i haven’t figured out how to do this yet. My goal is to make a "frame", where simple managers (not the admin) can edit some TV’s of a document (let it be a container), but aren’t able to modify (or even see) them in the inherited pages’ settings.

I’ve tried to solve this problem by using the Resource group + User group + Roles trio, and works fine, but there is a problem: A manager can modify the values of TVs in a container’s setup page, and all the values will be inheriting to the childs, but after that a manager is unable to see the child pages’ settings in the manager, because i prevented them to reach those pages by unchecking their box at the site’s access permission section.

http://ysera.wplanet.hu/modx_inherit_1.jpg

I’ve tried it with ManagerManager, without success:

I. mm_hideFields(’tv7’, ’2’); // Hide the template variable "tv7" for users with role "2"

Not an option, because if i hide a variable from a user with an exact role, it wouldn’t be able to reach this in the container ("frame") too.

II. mm_hideFields(’alias’, ’1’, ’3’);
// Hide the alias field for users with role "1" editing documents using template ID "3"

Would be better, just unfortunately the container and the inherited resources are using the same template, that’s why the same ID. So i could get the same by using the option I.

The solution would be preventing the manager to reach the TV’s on resources with an exact site ID, but i haven’t found the best way to accomplish this yet, and i can only hope there is a way to do this somehow.

Thank you in advance, and sry for my english!

Sincerely,
Ysera



]]>
ysera Oct 13, 2009, 11:44 AM https://forums.modx.com/thread/18118/how-could-i-hide-the-tv-s-of-my-inherited-documents-from-single-manager-users#dis-post-99227