Forums / Templates, Stylesheets, Page Layout / Member only EZ-Pages

Member only EZ-Pages

Locked

Started by alex_hill on 21 Apr 2007, 2:38 PM · Views: 7,027

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
21 Apr 2007, 2:38 PM
#1
alex_hill avatar

alex_hill

New Zenner

Join Date:
Apr 2007
Posts:
5
Plugin Contributions:
0

Member only EZ-Pages

Is there a way to make some EZ-Pages for logged in members only whilst some are available for guests?

21 Apr 2007, 3:15 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Member only EZ-Pages

This is not a built in feature to EZ-Pages at this time ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Apr 2007, 7:41 AM
#3
alex_hill avatar

alex_hill

New Zenner

Join Date:
Apr 2007
Posts:
5
Plugin Contributions:
0

Re: Member only EZ-Pages

Possibly something the Zen-Cart team could work on for a future version. I am sure it couldnt be too hard.

Is there a way to make ALL ez-pages for members only (not half and half). If not I will just have to put the information in as a free download I guess.

Cheers,
Alex

22 Apr 2007, 1:02 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Member only EZ-Pages

You could customize the /includes/pages/page to not allow access unless logged in ...

I am not sure how obnoxious it might be ...

Change the code in the header_php.php file from this:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

to read this:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

// if the customer is not logged on, redirect them to the login page
if (!$_SESSION['customer_id']) {
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}

Now when a link is clicked on to go to one of the pages the customer has to login ...

NOTE: the spiders cannot login to read anything now ... :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Apr 2007, 2:09 PM
#5
alex_hill avatar

alex_hill

New Zenner

Join Date:
Apr 2007
Posts:
5
Plugin Contributions:
0

Re: Member only EZ-Pages

Thanks for that, I might give it a go.

27 Apr 2007, 1:18 PM
#6
alex_hill avatar

alex_hill

New Zenner

Join Date:
Apr 2007
Posts:
5
Plugin Contributions:
0

Re: Member only EZ-Pages

For someone who might see this page looking for a similar fix, I just made my Documents side box available only to members. All I did was this:

Put
if ($_SESSION['customer_id']) {
CODE FROM SIDEBOX FILE
}

Works nicely in my situation

1 May 2007, 2:07 PM
#7
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

Thanks for that tip Alex. I was looking for a way to have a specific link come up only if a member has logged in and that 'if' statement was exactly what I needed.

10 May 2007, 2:44 PM
#8
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

Ajeh:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

// if the customer is not logged on, redirect them to the login page
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}

Would it be possible to expand that 'if' statement to include specific ez-page id's? For instance, I want id's 7-12, 15 and 16 to be password protected. All other pages wouldn't need to be.
10 May 2007, 9:30 PM
#9
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

Seek (along with some trial and error) and ye shall find!

Here's what seems to work for my "would it be possible" question above.

In 'includes/modules/pages/page/header_php.php' look for the following code around line 22:

$ezpage_id = (int)$_GET['id'];
if ($ezpage_id == 0) zen_redirect(zen_href_link(FILENAME_DEFAULT));
```Right after that code paste this:

// if you want certain ez-pages accessed by members only, redirect them to the login page
if (($ezpage_id == 5 || $ezpage_id == 6 || $ezpage_id == 10 || $ezpage_id == 14) && !$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}


I'm open to suggestions/corrections to this code since I'm no PHP programmer. Maybe this could be added in the next version so that it's controllable through 'admin/configuration/ez-pages settings' similar to where you have control of disabling headers, footers, and columns?
11 May 2007, 1:03 PM
#10
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

After sleeping, I realized that the above example is good only if you have a few ez-pages (in relation to your total number of ez-pages) that need protection. For instance, you have 4 ez-pages that need protection and you have 100 other ez-pages that you don't need protection for.

For my own purposes, I needed the opposite of that. Once I started adding to the 'if' statement with my page id's this morning, it dawned on me (no pun intended) that this was going to take forever. Duh! I have 100 ez-pages that need to be password protected and only a couple that don't. So here's what I came up with:

// all ez-pages will direct visitors to login unless the ez-page's id's are included in this 'if' statement 
if ($ezpage_id == 48 || $ezpage_id == 49) {
    } else if (!$_SESSION['customer_id']) {
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
```In this example, if I have 100 ez-pages, all of them will redirect to the login page except for the two with id's 48 and 49.
12 May 2007, 2:02 AM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Member only EZ-Pages

Bet that next you are gonna wanna add this to the Wish List ...

Interesting concept ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 May 2007, 12:42 PM
#12
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

I'll take that as a compliment, Linda. I'm feeling Zenducated! :smartalec:

I didn't think to add it to the wishlist... maybe it'll help someone in the future.

12 May 2007, 1:01 PM
#13
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Member only EZ-Pages

maybe it'll help someone in the future.

Based on your latest posted codes, I think there might even be something more that could be done (graphicly). Great idea. :smile:

10 Sep 2007, 11:37 PM
#14
heyzoos avatar

heyzoos

New Zenner

Join Date:
Mar 2006
Posts:
38
Plugin Contributions:
0

Re: Member only EZ-Pages

"This could also be modified to redirect to just about any ZC page that you have. Just change the zen_href_link() to suit your needs."

I tried to change the 'zen_href_link()' to the following example and the link doesn't work??? What is the proper way to replace this link?

Thanks.

zen_href_link(a href="http://www.mysite.com")

11 Sep 2007, 12:55 AM
#15
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

The structure of the zen_href_link in my last post is:
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'))

FILENAME_LOGIN is defined in 'includes/filenames.php' to tell the browser to go to the Login page. You need to have a page that is defined so that you can insert the same format. If you want to go to the root of your cart (which should be index.php), then change it to FILENAME_DEFAULT.

And I believe you'd want to change SSL to NONSSL... can anyone confirm that?

21 Jan 2008, 9:18 AM
#16
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Member only EZ-Pages

bradymc:

The structure of the zen_href_link in my last post is:
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'))

FILENAME_LOGIN is defined in 'includes/filenames.php' to tell the browser to go to the Login page. You need to have a page that is defined so that you can insert the same format. If you want to go to the root of your cart (which should be index.php), then change it to FILENAME_DEFAULT.

And I believe you'd want to change SSL to NONSSL... can anyone confirm that?Can confirm that you wouldn't want to remove the SSL. I wouldn't create an account or log in to a site (at least not with real data!) unless my information is going to be encrypted in transmission. Even if it were only to read information, I would still expect by user name and password to be protected.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

12 Feb 2008, 12:06 AM
#17
bradymc avatar

bradymc

New Zenner

Join Date:
Feb 2007
Location:
Dallas area
Posts:
75
Plugin Contributions:
0

Re: Member only EZ-Pages

kuroi:

Can confirm that you wouldn't want to remove the SSL. I wouldn't create an account or log in to a site (at least not with real data!) unless my information is going to be encrypted in transmission. Even if it were only to read information, I would still expect by user name and password to be protected.

I assumed that there would not be any logging in or exchanging sensitive information on the root of the site. That's why I suggested NONSSL. Guess some may have a login sidebox and it's better to be safe than sorry.

12 Feb 2008, 8:49 AM
#18
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Member only EZ-Pages

bradymc:

I assumed that there would not be any logging in or exchanging sensitive information on the root of the site. That's why I suggested NONSSL. Guess some may have a login sidebox and it's better to be safe than sorry.You were right first time. I missed the change of direction in the thread. If you're redirecting to FILENAME_DEFAULT then SSL isn't needed. Though in this case you can take advantage of the functions defaults and simply put zen_redirect(zen_href_link(FILENAME_DEFAULT))

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

17 Sep 2008, 6:22 PM
#19
beth_katherine avatar

beth_katherine

Zen Follower

Join Date:
Feb 2007
Posts:
158
Plugin Contributions:
0

Re: Member only EZ-Pages

Hello. I know this topic might be dead but I have a question. Is there any way to layer the membership Only section to discern between Members Only and Customers Only. I want to create a Customers Only section, how do I go about this?

Beth-katherine

17 Sep 2008, 6:27 PM
#20
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Member only EZ-Pages

Beth-katherine:

Is there any way to layer the membership Only section to discern between Members Only and Customers Only. I want to create a Customers Only section, how do I go about this?What is the difference between a member and a customer on your site? Are you asking how to detect which of the people who have signed up for accounts have actually purchased and offer them additional information? What do you want to happen if a "member" clicks on a "customers-only" link?

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)