Forums / General Questions / Why am I able to view Contact Us and not other links when Customer not Authorized?

Why am I able to view Contact Us and not other links when Customer not Authorized?

Locked

Started by ebaobao on 18 Sep 2010, 6:38 AM · Views: 2,335

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
18 Sep 2010, 6:38 AM
#1
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Why am I able to view Contact Us and not other links when Customer not Authorized?

Hello,

I currently have my website set in Admin>Customer Details
Customer Approval Status - Authorization Pending set to "1" must be authorize to browse.

What I noticed is that if the customer is not logged in, they can still click on the Contact Us link in the header and is able to see that page. But my other links which are ez pages cannot be viewed.

Is this because Contact us is a defined page? How can I make pages viewable even if they are not logged in and my website is configured to require authorization to browse?

Thanks.

18 Sep 2010, 9:44 AM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

In a stock Zencart installation, there is no 'Contact Us' link in the header, so the developers probably didn't anticipate users would have a link to that page in the header.

You could remove that link, or consider this: if I'm a customer and have trouble logging in, at least I'll be able to let you know if I can get to the Contact Us page.

18 Sep 2010, 1:44 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Actually there are pages that were allowed with intent ...

You can see which ones in the:
/includes/init_includes/init_customer_auth.php

If you want no pages, then change the setting from relaxed to strict:

if (!defined('DOWN_FOR_MAINTENANCE_TYPE')) define('DOWN_FOR_MAINTENANCE_TYPE', 'relaxed');

Or you can adjust individual pages when set to relaxed:

  case ((DOWN_FOR_MAINTENANCE == 'true') && !in_array($_GET['main_page'], array(FILENAME_LOGOFF, FILENAME_PRIVACY, FILENAME_CONTACT_US, FILENAME_CONDITIONS, FILENAME_SHIPPING))):

Adjust these as needed ... or leave as they are ...

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!

19 Sep 2010, 2:15 AM
#4
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda and Steve,

Thanks for the help. Steve you are right, I do want them to be able to view the Contact Us page. I also want to add more pages too but I'm not sure how to do that. I can't view any of the ez pages even when I link to them because of not being logged in. Linda is it possible to make custom pages that I can allow visitors to view even when I have those settings in my Admin and they are not logged in? How can I accomplish this? I just want to put a few links that have info on those pages.

Thanks.

19 Sep 2010, 3:33 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

If you look at the code that I posted, it indicates what pages can be seen when the Down for Maintenance is set ...

You can add additional pages to it ...

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!

20 Sep 2010, 6:28 PM
#6
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda,

Thank you for your help. Since my site is NOT set to Down For Maintenance, I should not be modifying those cases that you mentioned correct? I was thinking that I have to modify this area:

case (in_array($_GET['main_page'], array(FILENAME_LOGOFF, FILENAME_PRIVACY, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_CONDITIONS, FILENAME_SHIPPING, FILENAME_UNSUBSCRIBE))):

Since that is the area that says "// on special pages, allow customers to access regardless of store mode or cust auth mode". This is exactly what I want. If this is the area that I need to modify, then what is the syntax to link to say FILENAME_SHIPPING? Becuase when I tried to link to that page, it doesn't work as in nothing happens when I click on the link.

Also the comment mentions "on special pages". So my question is what desinates a "special page"?

20 Sep 2010, 6:32 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

You will need to go through that file for the sections such as:

  case (in_array($_GET['main_page'], array(FILENAME_LOGOFF, FILENAME_PRIVACY, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_CONDITIONS, FILENAME_SHIPPING, FILENAME_UNSUBSCRIBE))):
    // on special pages, allow customers to access regardless of store mode or cust auth mode
  break;

Check the whole file based on your settings as to which areas of the code might need adjusting for your needs ...

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!

20 Sep 2010, 6:48 PM
#8
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda,

So what is the syntax to say allow this page to be viewed? When I use this in my header. This is without changing anything in init_customer_auth.php.

<li><a href="<?php echo zen_href_link(FILENAME_CONTACT_US, '', '$request_type'); ?>" rel="nofollow">Contact</a></li>

and I click on the link, it works.

but using the exact code and just changing the contact us to conditions, that link doesn't work.

<li><a href="<?php echo zen_href_link(FILENAME_CONDITIONS, '', '$request_type'); ?>" rel="nofollow">Contact</a></li>

I think I know which area (case) I need to modify. But I'm not sure what the code is to say, allow these pages to be viewed.

Does this code

(in_array($_GET['main_page'], array(FILENAME_LOGOFF, FILENAME_PRIVACY, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_CONDITIONS, FILENAME_SHIPPING, FILENAME_UNSUBSCRIBE))):

mean that allow all those files to be viewable?

Sorry for asking so many questions, I'm trying my best to understand this section.

20 Sep 2010, 7:29 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

I must not be fully following what you are trying to do ...

The init_authorization controls what can be seen for the Authorized ...

What Customer Setting(s) are you using?

Currently, if using setting 1 on:

Customer must be Authorized to shop
0= Not required
1= Must be Authorized to Browse
2= May browse but no prices unless Authorized
3= Customer May Browse and May see Prices but Must be Authorized to Buy

Then these are controlled in the section for:

  case (CUSTOMERS_APPROVAL_AUTHORIZATION == '1' and $_SESSION['customer_id'] == ''):
  /**
   * customer must be logged in to browse
   */
//  if (!in_array($_GET['main_page'], array(FILENAME_LOGIN, FILENAME_CREATE_ACCOUNT))) {
  if (!in_array($_GET['main_page'], array(FILENAME_LOGIN, FILENAME_LOGOFF, FILENAME_CREATE_ACCOUNT, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_PRIVACY))) {
    if (!isset($_GET['set_session_login'])) {
      $_GET['set_session_login'] = 'true';
      $_SESSION['navigation']->set_snapshot();
    }
    zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  }
  break;

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!

20 Sep 2010, 7:54 PM
#10
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda,

Yes those are the settings I have. There is actually 2 settings in detail:

  1. Customer Shop Status is set to "1" - Must login to browse
  2. Customer Approval Status is set to "1" - Must be Authorized to Browse.

So with these settings and customer is not logged in, what is the syntax and where do I put it to still allow them to view those (shipping, conditions, privacy) pages?

20 Sep 2010, 8:18 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Those settings force the Login Page to be displayed ...

You can add links via Easy Pages to allow guests to reach the pages that are allowed in the:
/includes/init_includes/init_customer_auth.php

That way, anyone can click on the links to see these pages ...

They still have to Login and be approved to see anything else ...

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!

20 Sep 2010, 8:22 PM
#12
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Can I make pages that allow anyone to view regardless if they are logged in or not?

Thats what I'm saying. With the settings that I have, for some reason, the contact_us page is viewable (after they click the link of course) regardless if they are logged in or not. And that is what I want. But I want to make other pages just like contact_us to be viewable even when they are not logged in. Is that doable?

20 Sep 2010, 8:27 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Read the pages listed in the file carefully that are currently set to be allowed for anyone to see:

  if (!in_array($_GET['main_page'], array(
FILENAME_LOGIN, 
FILENAME_LOGOFF, 
FILENAME_CREATE_ACCOUNT, 
FILENAME_PASSWORD_FORGOTTEN, 
FILENAME_CONTACT_US, 
FILENAME_PRIVACY))) {

If you want more pages, add them ...

If you want less pages, remove them ...

Then, you make the links for people to get to the pages that are allowed ...

Easy Pages is one of the simplest methods to build the links that are allowed ...

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!

20 Sep 2010, 8:58 PM
#14
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda,

Thanks! That works. I tested with FILENAME_PRIVACY and it works. There were 2 sections that met my website conditions and the first section it didn't list any array with those filenames, that is why I was lost. The code you posted was in the 2nd section. My fault for not carefully reading through all of it.

But I'm testing with the ez pages now and I can't get that to work. I put in FILENAME_EZPAGES into the array and when I link it using
this code in the header.

<li><a href="<?php echo zen_href_link(FILENAME_EZPAGES, 'id=1&chapter=0') ?>" rel="nofollow">Help</a></li>

It doesn't allow me to view that page. So am I not linking it right or am I putting the wrong code inside the array?

Thanks.

21 Sep 2010, 12:06 AM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Are you trying to allow 1 specific Easy Pages to work? Or All EZ Pages to work?

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!

21 Sep 2010, 12:14 AM
#16
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

I want to allow all the ez pages to work. But knowing the option to allow individuals would be nice too. I'm just trying to put a link that links to an ez page and allow everyone (login or logout) to be able to view that page. thats it.

21 Sep 2010, 12:34 AM
#17
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Try changing the code to:

  case (CUSTOMERS_APPROVAL_AUTHORIZATION == '1' and $_SESSION['customer_id'] == ''):
  /**
   * customer must be logged in to browse
   */
//  if (!in_array($_GET['main_page'], array(FILENAME_LOGIN, FILENAME_CREATE_ACCOUNT))) {
  if (!in_array($_GET['main_page'], array(FILENAME_LOGIN, FILENAME_LOGOFF, FILENAME_CREATE_ACCOUNT, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_PRIVACY, FILENAME_EZPAGES))) {
    if (!isset($_GET['set_session_login'])) {
      $_GET['set_session_login'] = 'true';
      $_SESSION['navigation']->set_snapshot();
    }
    zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  }
  break;

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!

21 Sep 2010, 5:40 AM
#18
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hi Linda,

I tried that already. In my 2nd to last post is where I mentioned adding FILENAME_EZPAGES into the array and also how I link to it. Any ideas? I don't know if this helps, but I also was testing with adding FILENAME_SHIPPINGINFO into the array and try to link to it, but was having issues with that as well.

Thanks for helping me look into this matter.

21 Sep 2010, 1:56 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Look for each of the arrays where you see:
FILENAME_EZPAGES

Above each one, is the condition ... such as the the Approval is set to 1 and the customer is not logged in yet:

/**
 * if not down for maintenance check login status
 */
  case (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == ''):
  /**
   * customer must be logged in to browse
   */
  if (!in_array($_GET['main_page'], array(FILENAME_LOGIN, FILENAME_CREATE_ACCOUNT, FILENAME_EZPAGES))) {

If I have the FILENAME_EZPAGES added to that condition, then I can get to the Easy Page when I am not logged in and the Authorization is set to 1 ...

There are several of these in the file ...

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!

21 Sep 2010, 5:22 PM
#20
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

Re: Why am I able to view Contact Us and not other links when Customer not Authorized?

Hello Linda,

The stock file includes/init_includes/init_customer_auth.php does not have FILENAME_EZPAGES. So I don't see FILENAME_EZPAGES anywhere. I think you meant look in the file and find this condition:

case (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == ''):

Anywhere that has this condition to add FILENAME_EZPAGES into the array inside that condition. Guess what? It works!

The FILENAME_EZPAGES had to be added under 2 different places with that condition for it to work. All this time, I was only adding to one of the condition.

I just tested and it works. Thank you very much for your help in this matter. I will run and try not to bug so much. I hope this helps others out there that need to implement this. Cheers :clap: