criat Posted January 5, 2014 Share Posted January 5, 2014 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 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted January 5, 2014 Share Posted January 5, 2014 Well, at the top of the page it will display that you're logged in as an admin. 0 Quote Link to comment Share on other sites More sharing options...
cesiumdeth Posted January 5, 2014 Share Posted January 5, 2014 I think this might help: http://forum.whmcs.com/showthread.php?57278-Introduction-to-WHMCS-SMARTY-Debugging-Display-if-customer-OR-admin-are-logged-in 0 Quote Link to comment Share on other sites More sharing options...
criat Posted January 7, 2014 Author Share Posted January 7, 2014 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) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 7, 2014 Share Posted January 7, 2014 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. 0 Quote Link to comment Share on other sites More sharing options...
hogava Posted February 8, 2020 Share Posted February 8, 2020 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 8, 2020 Share Posted February 8, 2020 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. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.