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?
New Zenner
Is there a way to make some EZ-Pages for logged in members only whilst some are available for guests?
Oba-san
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 ...
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!
New Zenner
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
Oba-san
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 ...
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!
New Zenner
Thanks for that, I might give it a go.
New Zenner
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
New Zenner
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.
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
New Zenner
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.
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
New Zenner
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?
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
New Zenner
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.
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
Oba-san
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 ...
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!
New Zenner
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.
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
Suspended
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:
New Zenner
"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")
New Zenner
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?
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
Totally Zenned
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)
New Zenner
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.
Brady* - using 1.3.7*
Go Mylo Web Design
Go Mylo Domains
Go Mylo Templates
Totally Zenned
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)
Zen Follower
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
Totally Zenned
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)
Tell staff why this post should be reviewed.