Check user role in templates

Aries-Belgium

New member
Joined
Jul 11, 2012
Messages
4
Hi,

Is there a way to check the user role in the header template with an if statement?

Thanks,
Aries-Belgium.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Hi,

Is there a way to check the user role in the header template with an if statement?

Thanks,
Aries-Belgium.
Hello,

There is already a token |USERTYPE|, so you can check it

Code:
|*if USERTYPE="admin"|
admin code here
|*endif|
|*if USERTYPE="reseller"|
reseller code here
|*endif|
|*if USERTYPE="user"|
user code here
|*endif|
Note, if you as admin switch to its reseller level, your usertype will still remain as admin, and it's actual for user level. But if you login into reseller/user account from admin/reseller level, then your usertype will also change to corresponding one.
 

Aries-Belgium

New member
Joined
Jul 11, 2012
Messages
4
Thanks for the replies!

I needed that to show a menu in the header template depending on the user type but I'm better off by splitting of the header template into the general header template and the template_*_top templates of each user type. Especially if switching from admin to reseller doesn't change the USERTYPE variable it's not possible to do it like I initially thought.
 
Top