Drop-Down Menus for Admin Only

rogermh

Joined: 2005-01-09
Posts: 102
Posted: Sun, 2005-04-17 04:24

I'd like to turn on the drop-down menus for the Admin only. I think I've located the code that creates the drop-down (located in /layouts/matrix/templates/local/albumBody.tpl):

	{if !empty($child.itemLinks)}
	  <select onchange="{literal}javascript:if (this.value) { newLocation = this.value; this.options[0].selected = true; location.href= newLocation; }{/literal}">
	    <option label="{if $child.canContainChildren}{g->text text="&amp; album actions &amp;"}{else}{g->text text="&amp; item actions &amp;"}{/if}" value="">{if $child.canContainChildren}{g->text text="&amp; album actions &amp;"}{else}{g->text text="&amp; item actions &amp;"}{/if}</option>

	    {foreach from=$child.itemLinks item=link}
	      <option label="{$link.text}" value="{$link.url}">{$link.text}</option>
	    {/foreach}
	  </select>
	{/if}

So I basically want to enclose that code with an "if-then" statement that asks "if the admin is logged in, then execute this code". Can anybody help me with this if-then statement? Is there a specific G2 variable that indicates whether the admin is logged in?

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Sun, 2005-04-17 07:05
 
rogermh

Joined: 2005-01-09
Posts: 102
Posted: Mon, 2005-04-18 02:50

Thanks, that did the trick. I should have done a more thorough search before I posted. :(

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-04-19 18:44

I have made a standard template variable so user info is available to every view. You can reference these in any tpl: $user.userName, $user.fullName, $user.isGuest, $user.isRegisteredUser, $user.isAdmin
Update from cvs in a few hours or get tomorrow's nightly snapshot to try this out. If you have any references to $layout.user in your local tpl files you'll need to change these to just $user.

 
sswiger

Joined: 2005-05-13
Posts: 6
Posted: Fri, 2005-06-03 22:18

works, thanks much!