Zen Cart Logo
Forums / General Questions / Require Login for Certain Pages

Require Login for Certain Pages

Locked

Views: 1,404

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
10 Jun 2007, 8:01 AM
#1
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Require Login for Certain Pages

I'm looking to require login on certain define pages - I have the "about us" contribution installed (and cloned for 4 other pages).. and need one of them to be logged into to view. How would I go about doing this?

10 Jun 2007, 3:39 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Require Login for Certain Pages

Look in the files of pages that already do this, such as account;
/includes/modules/pages/account/header_php.php

if (!$_SESSION['customer_id']) {
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}

This code requires the customer be logged in or taken to login then returned after to where the customer was headed ... :smile:

10 Jun 2007, 9:12 PM
#3
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Require Login for Certain Pages

Thank you for the help! Works like a charm :)

10 Jun 2007, 10:35 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Require Login for Certain Pages

Thanks for the update that this was able to work the way you needed it to ... :smile:

26 Jun 2007, 1:57 PM
#5
dogmatic69 avatar

dogmatic69

New Zenner

Join Date:
May 2006
Posts:
40
Plugin Contributions:
0

Re: Require Login for Certain Pages

Ajeh:

if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}


Does this work with EZ pages?  if not, is it possible to do the same thing (only let registered people view a certain and/or all ez pages)

And if it does work were would i have to put it?

thanks in advance