Check for the opposite of $user.isAdmin

tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2011-02-25 15:03

I'm looking to create a condition that triggers for everyone EXCEPT the admin. I know that $user.isAdmin will work for creating code only FOR the admin; I'm looking to do the opposite. (Maybe even better if it's triggered for everyone EXCEPT logged in users.)

I also would like the condition to return false if the page is the login page.

Can't seem to get this sorted out.

Thanks!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2011-02-25 15:27
 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2011-02-25 16:06

Duh! Wow. Thanks!

Is there a way to check for the login page? I tried $theme.pageType == 'login' but that doesn't work.

Also, should if (!$gallery->user->isLoggedIn()) work to check for logged in users?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2011-02-25 16:18
tempg wrote:
Duh! Wow. Thanks!

Is there a way to check for the login page? I tried $theme.pageType == 'login' but that doesn't work.

pageType may just be 'user' don't remember.

tempg wrote:
Also, should if (!$gallery->user->isLoggedIn()) work to check for logged in users?

try $user.isRegisteredUser or $user.isGuest

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2011-02-25 16:29

actually unless a theme specifically implements others the only pageTypes are:
admin, album, photo, progressbar, error and module modules/core/classes/GalleryTheme.class

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2011-02-25 16:42

$user.isRegisteredUser works. (I didn't try $user.isGuest but I presume that would work as well.

suprsidr wrote:
actually unless a theme specifically implements others the only pageTypes are:
admin, album, photo, progressbar, error and module modules/core/classes/GalleryTheme.class

That clears up a good bit!
I was able to just use $theme.pageType != 'album') || ($theme.pageType != 'photo'); it will likely now also show up on a few other pages, but I'm reasonably sure that it'll work for me.

Thanks again!