Jump to content

Must be logged in to access


mark1million

Recommended Posts

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
}
?>

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

Guest lorathon

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";
}
?>

Link to comment
Share on other sites

Guest lorathon

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 :D

Link to comment
Share on other sites

  • Moderators

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

Link to comment
Share on other sites

  • 8 months later...
Guest lorathon

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

}

Link to comment
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.   Restore formatting

  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.

Loading...
×
×
  • Create New...