CapitalConnectVirtualGroup Posted January 28, 2016 Report Share Posted January 28, 2016 Hey guys, So I'm new to skinning, and am basically needing assitance! Can anybody tell me the code/provide me with a snippet for the login link? I've got a screenshot to put it into context - basically, if pilot is logged out, display login button, if logged in display logout button etc etc. I assume the principle for an Admin Centre Link is the same too.. I've already added the buttons, I'm working on menu bar before I add it to the main "template" file as I always do, hence the lack of a detailed screenie! Thanks in advance! Regards, Damon Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 28, 2016 Administrators Report Share Posted January 28, 2016 <?php if(Auth::LoggedIn()) { //do stuff because the user is logged in } else { //do other stuff because the user is not logged in } ?> Quote Link to comment Share on other sites More sharing options...
CapitalConnectVirtualGroup Posted January 29, 2016 Author Report Share Posted January 29, 2016 Perfect, thanks! What would I change if(Auth::LoggedIn()) to if I wanted to display only to Admin Users? -D Quote Link to comment Share on other sites More sharing options...
web541 Posted January 29, 2016 Report Share Posted January 29, 2016 Try this <?php if(Auth::LoggedIn()) { if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { echo '<li><a href="'.fileurl('/admin').'">Admin Center</a></li>'; } ?> Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 29, 2016 Moderators Report Share Posted January 29, 2016 Or even: <?php if(Auth::LoggedIn() && PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { echo '<li><a href="'.fileurl('/admin').'">Admin Center</a></li>'; } ?> 1 Quote Link to comment Share on other sites More sharing options...
CapitalConnectVirtualGroup Posted January 31, 2016 Author Report Share Posted January 31, 2016 Thanks guys!! :-) -Damon Quote Link to comment Share on other sites More sharing options...
CapitalConnectVirtualGroup Posted January 31, 2016 Author Report Share Posted January 31, 2016 But with that added I get Parse error: syntax error, unexpected '<' in /home/ccvgnet/public_html/pilots/lib/skins/iceair/layout.php on line 58 even though the only < is the <li> and <a href="..."> blah blah blah EDIT: Fixed by using <?php if(Auth::LoggedIn()) { echo '<li><a href="http://pilots.ccvg.net/index.php/Login/logout"/>Log Out</a></li>'; } else { echo '<li><a href="http://pilots.ccvg.net/index.php/Login">Login</a></li>'; echo '<li><a href="http://pilots.ccvg.net/index.php/Registration/">Join Us</a></li>'; } ?> Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 31, 2016 Moderators Report Share Posted January 31, 2016 Maybe there is already an opened php before <?php ? Try adding this "?>" before the "<?php" of the above part of code. 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.