Moderators mark1million Posted July 6, 2010 Moderators Report Share Posted July 6, 2010 HI Nabeel, Dave and Jeff Is there a code snipped to add to the page to make it that you must be logged to to view or access? I would like to make the pilots list only viewable by members. Cheers. Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 6, 2010 Report Share Posted July 6, 2010 core_navigation.tpl<li><a href="<?php echo url('/'); ?>">Home</a></li> <?php if(!Auth::LoggedIn()) { // Show these if they haven't logged in yet ?> <?php } else { // Show these items only if they are logged in ?> <li><a href="<?php echo url('/pilots'); ?>">Pilots</a></li> //Place the Pilots link here <?php } ?> <?php echo $MODULE_NAV_INC;?> <?php if(Auth::LoggedIn()) { if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { echo '<li><a href="'.fileurl('/admin').'">Admin Center</a></li>'; } ?> <li><a href="<?php echo url('/logout'); ?>">Log Out</a></li> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted July 6, 2010 Author Moderators Report Share Posted July 6, 2010 Hi Jeff, Thanks for that but i have that already, if someone hits the pilots list directly it will still show them, what im after is like the Airmail feature if you try to access that you get a redirect to you must be logged in to access this page etc. Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 6, 2010 Report Share Posted July 6, 2010 is the pilots page listed in here as well? <li><a href="<?php echo url('/'); ?>">Home</a></li> <?php if(!Auth::LoggedIn()) { // Show these if they haven't logged in yet ?> <?php } else it shouldn't be showing if it isn't, unless I missed something. Let me do a little more searching for you. Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 6, 2010 Report Share Posted July 6, 2010 Ah crap. nm on the last post the "Show if logged in" is just the code to show a certain page on the menu. Still looking for you though. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 6, 2010 Report Share Posted July 6, 2010 What you need to do is add the entire sheet into the brackets of this <?php if(Auth::LoggedIn()) {?> //Put the entire sheet here <?php } else { echo "You must be logged in to view this page"; } ?> Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted July 6, 2010 Author Moderators Report Share Posted July 6, 2010 What you need to do is add the entire sheet into the brackets of this <?php if(Auth::LoggedIn()) {?> //Put the entire sheet here <?php } else { echo "You must be logged in to view this page"; } ?> Cheers Jeff Thats the one Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 6, 2010 Report Share Posted July 6, 2010 Thanks Jeff, I knew I was close. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 6, 2010 Report Share Posted July 6, 2010 No problem guys. And you were close Jeff. It is basically the same snippet. You just have to add it to ever page. The reason is that you could just entire the actual address to the page bypassing the normal navigation bar. Glad I could help out Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted July 7, 2010 Administrators Report Share Posted July 7, 2010 If you don't mind me saying, it's better to do this: <?php if(Auth::LoggedIn() == false) { echo 'You must be logged in to view this page!'; return; } ?> No else or other brackets to keep track of Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted July 7, 2010 Report Share Posted July 7, 2010 Nabeel always has to make it just that much easier. Nice Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted July 7, 2010 Author Moderators Report Share Posted July 7, 2010 That would explain the repeat in some pages that "You must be logged in to view this page" Cheers guys. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted July 7, 2010 Author Moderators Report Share Posted July 7, 2010 Still the same repeat on the pilots list, This is what im using then its pulling the error formatting from the css. <?php if(Auth::LoggedIn() == false) { echo '<div id="error">Please login to view this page.</div></div>'; return; } ?> That extra closing div is only relevant on the ObsessBlue templates Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted March 9, 2011 Author Moderators Report Share Posted March 9, 2011 Just quickly going back to this Nabeel if i use your way i get a repeat of the login message for the amount of hubs that i have but if i place the page in the brackets that fixes it, is their another way? Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted March 10, 2011 Report Share Posted March 10, 2011 Mark, Place it at the beginning of the module not on the template Example public function index() { if(Auth::LoggedIn() == false) { echo '<div id="error">Please login to view this page.</div>'; return; } //do whatever that logged in uses can access or see } Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted March 10, 2011 Author Moderators Report Share Posted March 10, 2011 Ah got you. Cheers Jeff. 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.