Zen Cart Logo
Forums / General Questions / Ezpage only available to view after login?

Ezpage only available to view after login?

Locked

Views: 995

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
7 Feb 2010, 12:48 AM
#1
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Location:
London
Posts:
127
Plugin Contributions:
0

Ezpage only available to view after login?

Dear All,

Been searching on forum but can't find any exsiting thread about this.

I would like to create a ezpage but only available for registered users. If they try to look at this page, it prompt them to log in or sign up and account. Is this possible?

Many thanks for help.

Genesis

7 Feb 2010, 8:17 AM
#2
rainmist avatar

rainmist

New Zenner

Join Date:
Jun 2007
Posts:
71
Plugin Contributions:
0

Re: Ezpage only available to view after login?

It seems that zen cart does not have control rights for different roles.

23 Feb 2010, 5:36 PM
#4
gamenano avatar

gamenano

Zen Follower

Join Date:
Apr 2009
Location:
London
Posts:
127
Plugin Contributions:
0

Re: Ezpage only available to view after login?

I definately needed this feature. Here's an even simpler version.

Replace this:

Code:

<div><?php echo $var_pageDetails->fields['pages_html_text']; ?></div>with this:

Code:

<div><?php eval(stripslashes('?>' . $var_pageDetails->fields['pages_html_text'])); ?></div>This way you don't have worry about php being 'on' in the ezpage - you can make the code of the page html with php inside it (a lot easier).

Tim

Where do I find those code?

23 Feb 2010, 8:37 PM
#5
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Ezpage only available to view after login?

Read the 6 messages above that one, then the 7th will make sense. Tim just simplified what I had posted above there.

24 Feb 2010, 10:20 PM
#6
kromero avatar

kromero

New Zenner

Join Date:
Feb 2010
Posts:
6
Plugin Contributions:
0

Re: Ezpage only available to view after login?

Hey guys,

Thanks for this. In the code found on your link http://www.zen-cart.com/forum/showthread.php?t=53139

<?php if ($_SESSION['customer_id']) { echo('You are signed in and have access to the members only area.'); }else{echo('You are not signed in, and do not have access to the members only area.');} ?>

Is it possible to specify a specific customer_id ? Like only show this page to customer id # 1?

Thanks,
Kristina

25 Feb 2010, 1:49 AM
#7
kromero avatar

kromero

New Zenner

Join Date:
Feb 2010
Posts:
6
Plugin Contributions:
0

Re: Ezpage only available to view after login?

I did it! :clap: For those who would like to know how to hide a page for logged in members AND only give access to a select member or members.

Insert this in an ezpage: (to learn how to insert php in an EZpage, look at the link above)

<?php if ($_SESSION['customer_id'] == "1" ) { echo('Access.'); }else{echo('You are not signed in, and do not have access to the members only area.');} ?>

Change number "1" to the customer number you want to have access to the page. You can find your customer number by going to "customers" in the admin section of your Zen Cart. The number is right next to the listing.

Obviously, change the echo'' to the statement you want your logged in member to see.