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="& album actions &"}{else}{g->text text="& item actions &"}{/if}" value="">{if $child.canContainChildren}{g->text text="& album actions &"}{else}{g->text text="& item actions &"}{/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?
Posts: 75
Maybe this will help you?
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=129399
Posts: 102
Thanks, that did the trick. I should have done a more thorough search before I posted.
Posts: 8601
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.
Posts: 6
works, thanks much!