album actions

arnoadam

Joined: 2004-09-29
Posts: 32
Posted: Sat, 2005-03-12 13:13

Hey!
I would like to have the "album actions" and "item actions" menu's only to be shown when you are logged in as a user. I've been trying to change the albumbody.tpl but I don't now what I should change to make this work...

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2005-03-13 20:51

This is a quick hack, but it should work. Edit albumBody.tpl and on line 106 change:

            {if !empty($child.itemLinks)} 

to:

            {if !empty($child.itemLinks) && $layout.user.id != 4} 

Then edit templates/sidebar.tpl and on line 58 change:

  {if ($layout.show.sidebarActions && !empty($layout.itemLinks))} 

to:

  {if ($layout.show.sidebarActions && !empty($layout.itemLinks)) && $layout.user.id != 4} 

That should do it for you. We'll make it easier to control this in the future.

 
arnoadam

Joined: 2004-09-29
Posts: 32
Posted: Mon, 2005-03-14 09:13

thnx!

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Fri, 2005-04-01 15:32
bharat wrote:
This is a quick hack, but it should work. Edit albumBody.tpl and on line 106 change:

            {if !empty($child.itemLinks)} 

to:

            {if !empty($child.itemLinks) && $layout.user.id != 4} 

FYI: After the recent change to albumBody.tpl the code is now at line 98 - or just above the javascript in case things change again.

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Tue, 2005-04-19 06:10

This trick doesn't work for me anymore:

            {if !empty($child.itemLinks) && $layout.user.id != 4} 

Any idea why it won't work? I'm on a April 17 snapshot.

 
mindless
mindless's picture

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

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.

 
Kirill
Kirill's picture

Joined: 2004-12-22
Posts: 53
Posted: Tue, 2005-04-19 23:48

Very helpful mindless, thanks.

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Wed, 2005-04-20 08:15

Simple yet great addition. Thanks Mindless! 8)

This is just an idea I got, but it might be worthwhile to consider adding since some like to cut down on the number of items in the albumbody view.

Maybe the admin should have a simple option to set when the Item Action Menu is viewable? Like:

• Everybody
• Users & Admin only
• Admin only
• Nobody (disabled)

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Thu, 2005-06-09 07:51

Okay, I had couple of people asking me how to remove the Item Action drop-down menu for guests, so I might as well update this thread.

Make a copy of the albumBody.tpl in the layout you
currently use (like Matrix) and put it in a /local/ dir.

Go to line 98 where you have this code:

{if !empty($child.itemLinks)}

and change it to:

{if !empty($child.itemLinks) && $user.isRegisteredUser}

...in order to have the item action menu show for all login users

or...

{if !empty($child.itemLinks) && $user.isAdmin}

...in order to have the item action menu show only for the admin.

 
ChrisJohnson00TA

Joined: 2004-03-15
Posts: 167
Posted: Sat, 2005-06-11 04:29

Wow! Makes G2 look SO much cleaner.

Thanks.

 
fjellaksel

Joined: 2005-10-19
Posts: 31
Posted: Tue, 2006-04-25 13:14

Eh, this is probably a stupid question, but here we go:

I can't seem to find the albumBody.tpl file.
Searched the whole gallery2 site, and no match!

I'm using Gallery2, so why is this file missing on my server?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-04-25 14:32

because this topic is 10 months old.. the file is album.tpl now

 
justchil
justchil's picture

Joined: 2003-02-07
Posts: 225
Posted: Tue, 2006-06-13 17:41

The closest thing I see in album.tpl is:

{g->block type="core.ItemLinks" item=$child links=$child.itemLinks}

I'd like to make my sidebar only visible for logged in users as well :)

 
justchil
justchil's picture

Joined: 2003-02-07
Posts: 225
Posted: Tue, 2006-06-13 17:56

OK so I did this in album.tpl

Changed:
{if !empty($theme.params.sidebarBlocks)}
To:
{if !empty($theme.params.sidebarBlocks) && $user.isRegisteredUser}

 
korpdata

Joined: 2006-05-25
Posts: 43
Posted: Thu, 2006-06-22 22:40

Another way is to change the album's permissions.
[ KORPDATA ] Innovando Soluciones Empresariales