Jump to content
criat

If Is Admin = Show Something - Is it possible?

Recommended Posts

Hello,

 

I'm looking for a function to run something if the user is an administrator, something like

 

{if $isadmin}

You are an admin.

{else}

You are not an admin.

{/if}

 

Any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

Thanks cesium, saw that but only works if admin X is logged in, I'm looking for a variable that works for any admin

 

@DennisMidjord

I've removed that bar a long time ago, I don't have it anymore :/ (it was annoying)

Share this post


Link to post
Share on other sites
Thanks cesium, saw that but only works if admin X is logged in, I'm looking for a variable that works for any admin

I think the last block of code from cesiumdeth's link is actually what you're looking for...

 

{if $smarty.session.adminid}

forget the bit about admin X being logged in, logically I would assume the session variable only exists if anyone is logged in as an admin - so this should be sufficient for your needs...

 

if you wanted only a certain admin(s) to see something (e.g admin X), then I guess you could expand the code to be more specific...

 

{if $smarty.session.adminid eq "1"}
do this...
{/if}

but in your case, {if $smarty.session.adminid} should be all that you need.

Share this post


Link to post
Share on other sites
On 1/7/2014 at 5:51 PM, brian! said:

I think the last block of code from cesiumdeth's link is actually what you're looking for...

 

 


{if $smarty.session.adminid}
 

 

forget the bit about admin X being logged in, logically I would assume the session variable only exists if anyone is logged in as an admin - so this should be sufficient for your needs...

 

if you wanted only a certain admin(s) to see something (e.g admin X), then I guess you could expand the code to be more specific...

 

 


{if $smarty.session.adminid eq "1"}
do this...
{/if}
 

 

but in your case, {if $smarty.session.adminid} should be all that you need.

how can i use $smarty variable in custom php page?

Share this post


Link to post
Share on other sites
2 hours ago, hogava said:

how can i use $smarty variable in custom php page?

i assume the custom php page has a .tpl template ?? if so, that's where the Smarty goes. 🙂

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated