Author Topic: Index Redirect For Logged In Members  (Read 1666 times)

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 514
  • Karma: +45/-2
  • Etano Contributor (Skins & Mods)
Index Redirect For Logged In Members
« on: October 04, 2014, 11:49:24 AM »
Simple little tweak to redirect logged in members when they try to load the main index page (example www.yoursite.com)

Open index.html (its in your skins_site  > def folder)

And simply paste the code below between the <head>  </head> tags.

Code: [Select]
<!--opt name="tplvars.user_logged"--> <meta HTTP-EQUIV="REFRESH" content="0; url={tplvars.relative_url}home.php"><!--/opt name="tplvars.user_logged"-->
Now when logged in users try to access the homepage they’ll get redirected to My Home instead.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Re: Index Redirect For Logged In Members
« Reply #1 on: October 04, 2014, 01:01:53 PM »
Thanks KHDev!
I do recall seeing this in the forum in the past and forgot about it. I didn't realize it was never moved to Code Contributions.

Thanks for the input.  :)
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Re: Index Redirect For Logged In Members
« Reply #2 on: October 04, 2014, 01:06:48 PM »
This is what I have inside my index.php file. It does something similar

Code: [Select]
// "if" statement added to redirect a logged user to the home page when clicking on the site logo
if (!empty($_SESSION[_LICENSE_KEY_]['user']['user_id'])) {
     header("LOCATION: home.php");
}

I placed it between the lines that say
require _BASEPATH_.'/includes/user_functions.inc.php';

and

check_login_member('all');
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.