Forums / Basic Configuration / Sidebox Visible to Logged in Members Only

Sidebox Visible to Logged in Members Only

Views: 5,966

Results 1 to 20 of 33
17 Dec 2008, 7:17 AM
#1
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Sidebox Visible to Logged in Members Only

I have already tried the tutorial located at: https://www.zen-cart.com/tutorials/index.php?article=279, but can not get this to work for the "Information" or "More-Information" sideboxes.

I am assuming the these must also be turned on Left or Right in the Layout Boxes area, but do they need to be turned on for Single Column also?

17 Dec 2008, 7:09 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

You need to "clone" the method of using the code to fix the settings of the sidebox you are working with ...

/includes/modules/sideboxes/information.php

Can be customized using the code:

<?php
/**
 * information sidebox - displays list of general info links, as defined in this file
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: information.php 4132 2006-08-14 00:36:39Z drbyte $
 */

  unset($information);

// test if box should display
  $show_information= false;

// test if box should display based on customer is logged in
  if (!$_SESSION['customer_id']) {
    $show_information= false;
  } else {
    $show_information= true;
  }
  
  if ($show_information == true) {

  if (DEFINE_SHIPPINGINFO_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a>';
  }
  if (DEFINE_PRIVACY_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a>';
  }
  if (DEFINE_CONDITIONS_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a>';
  }
  if (DEFINE_CONTACT_US_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>';
  }

// Forum (phpBB) link:
  if ( (isset($phpBB->phpBB['db_installed_config']) && $phpBB->phpBB['db_installed_config']) && (isset($phpBB->phpBB['files_installed']) && $phpBB->phpBB['files_installed'])  && (PHPBB_LINKS_ENABLED=='true')) {
    $information[] = '<a href="' . zen_href_link($phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX, '', 'NONSSL', false, '', true) . '" target="_blank">' . BOX_BBINDEX . '</a>';
// or: $phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX
// or: str_replace(str_replace(DIR_WS_CATALOG, '', DIR_FS_CATALOG), '', DIR_WS_PHPBB)
  }

  if (DEFINE_SITE_MAP_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_SITE_MAP) . '">' . BOX_INFORMATION_SITE_MAP . '</a>';
  }

  // only show GV FAQ when installed
  if (MODULE_ORDER_TOTAL_GV_STATUS == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_GV_FAQ) . '">' . BOX_INFORMATION_GV . '</a>';
  }
  // only show Discount Coupon FAQ when installed
  if (DEFINE_DISCOUNT_COUPON_STATUS <= 1 && MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_DISCOUNT_COUPON) . '">' . BOX_INFORMATION_DISCOUNT_COUPONS . '</a>';
  }

  if (SHOW_NEWSLETTER_UNSUBSCRIBE_LINK == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_UNSUBSCRIBE) . '">' . BOX_INFORMATION_UNSUBSCRIBE . '</a>';
  }

  require($template->get_template_dir('tpl_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_information.php');

  $title =  BOX_HEADING_INFORMATION;
  $title_link = false;

  require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>

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!

18 Dec 2008, 5:14 AM
#3
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Excellent. It works. I just couldn't figure out where to put the code. It wouldn't work correctly, but yours works beautifully!

18 Dec 2008, 4:29 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

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

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!

18 Dec 2008, 6:50 PM
#5
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Does this mean that none of the items in that menu will be able to be indexed by search engines? I need these to be absolutely secure from any prying eyes.

19 Dec 2008, 4:47 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

Unless the spider has learned to login and can obtain a customers_id then nothing can show ...

No customers_id is the same as a guest ...

Have you tested this as a guest and tested this as a logged in customer?

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 Dec 2008, 6:59 AM
#7
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

This is the customer's site: https://www.welslflmilw.com. I have set up a login form. You can test it out with username: jeskremer and password: 022877. After logging in, there is a Volunteers Section menu that pops-up (An overriden "Information" menu).

Unfortunately each of the newly created Define Pages addresses are able to be placed in the browser bar and can be opened even when not logged in. I am sure that there is a way to do this on the "Information" override, but I can't quite figure it out.

Here is my current override:

<?php
/**
 * information sidebox - displays list of general info links, as defined in this file
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: information.php 4132 2006-08-14 00:36:39Z drbyte $
 */

  unset($information);

// test if box should display
  $show_information= false;

// test if box should display based on customer is logged in
  if (!$_SESSION['customer_id']) {
    $show_information= false;
  } else {
    $show_information= true;
  }
  
  if ($show_information == true) {

  if (DEFINE_MEMBER_INFO_STATUS <= 1) {
$information[] = '<a href="' . zen_href_link(FILENAME_MEMBER_INFO) . '">' .
BOX_INFORMATION_MEMBER_INFO. '</a>';
}
if (DEFINE_CALENDAR_STATUS <= 1) {
$information[] = '<a href="' . zen_href_link(FILENAME_CALENDAR) . '">' .
BOX_INFORMATION_CALENDAR. '</a>';
}
  if (DEFINE_SHIPPINGINFO_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a>';
  }
  if (DEFINE_PRIVACY_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a>';
  }
  if (DEFINE_CONDITIONS_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a>';
  }
 
  				
// Forum (phpBB) link:
  if ( (isset($phpBB->phpBB['db_installed_config']) && $phpBB->phpBB['db_installed_config']) && (isset($phpBB->phpBB['files_installed']) && $phpBB->phpBB['files_installed'])  && (PHPBB_LINKS_ENABLED=='true')) {
    $information[] = '<a href="' . zen_href_link($phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX, '', 'NONSSL', false, '', true) . '" target="_blank">' . BOX_BBINDEX . '</a>';
// or: $phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX
// or: str_replace(str_replace(DIR_WS_CATALOG, '', DIR_FS_CATALOG), '', DIR_WS_PHPBB)
  }

  if (DEFINE_SITE_MAP_STATUS <= 1) {
    $information[] = '<a href="' . zen_href_link(FILENAME_SITE_MAP) . '">' . BOX_INFORMATION_SITE_MAP . '</a>';
  }

  // only show GV FAQ when installed
  if (MODULE_ORDER_TOTAL_GV_STATUS == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_GV_FAQ) . '">' . BOX_INFORMATION_GV . '</a>';
  }
  // only show Discount Coupon FAQ when installed
  if (DEFINE_DISCOUNT_COUPON_STATUS <= 1 && MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_DISCOUNT_COUPON) . '">' . BOX_INFORMATION_DISCOUNT_COUPONS . '</a>';
  }

  if (SHOW_NEWSLETTER_UNSUBSCRIBE_LINK == 'true') {
    $information[] = '<a href="' . zen_href_link(FILENAME_UNSUBSCRIBE) . '">' . BOX_INFORMATION_UNSUBSCRIBE . '</a>';
  }

  require($template->get_template_dir('tpl_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_information.php');

  $title =  BOX_HEADING_INFORMATION;
  $title_link = false;

  require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
19 Dec 2008, 7:04 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

I cannot get any login to work and create account goes to another site or something ...

Maybe tomorrow when I am not asleep ... :blink:

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 Dec 2008, 7:06 AM
#9
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Oops. I meant [email protected] and 022877

19 Dec 2008, 2:50 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

You would want to add a check to the header_php.php for the define page in the:
/includes/modules/pages/page/header_php.php

Something like:

// 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'));
  }

NOTE: this will only control those pages that are using the "page" in the URL meaning:
index.php?main_page=page

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 Dec 2008, 2:57 PM
#11
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Excellent! Thank you so much.

For anyone else that cares, here is where I put that code:

<?php
/**
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Define Generator v0.1 $
*/

// DEFINTELY DON'T EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!

// 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'));
  }

	$_SESSION['navigation']->remove_current_page();
	require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));

	// include template specific file name defines
	$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MEMBER_INFO, 'false');
	$breadcrumb->add(NAVBAR_TITLE);
?>
19 Dec 2008, 3:42 PM
#12
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Another snag,

I have Customer Approval Status - Authorization Pending set to "1", but they can still view pages off of this menu immediately before being approved by admin. Is there a hack for this also?

19 Dec 2008, 3:54 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

What version of Zen Cart are you using?

What this an upgrade? That header_php.php doesn't look current but it could be my imagination ...

To test Authorization ... you need to be sure you always test with a new session as that is a one time test once set ...

How are you running your Authorization now based on the settings in the Customer Details?

Customer must be approved to shop
0= Not required
1= Must login to browse
2= May browse but no prices unless logged in
3= Showroom Only

It is recommended that Option 2 be used for the purposes of Spiders if you wish customers to login to see prices.

Customer Approval Status - Authorization Pending
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

It is recommended that Option 2 or 3 be used for the purposes of Spiders

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 Dec 2008, 3:57 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

A good place to see an example of how this works is in the functions_prices.php for the function zen_get_products_display_price ...

This shows the various combinations used to test for the current status of a customer ...

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 Dec 2008, 4:00 PM
#15
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

Current settings:

Shop status: 0
Authorization pending: 1

19 Dec 2008, 4:01 PM
#16
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

This is also the current version of Zencart

19 Dec 2008, 4:26 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

I take it you have an add-on then that you are using ...

Meanwhile ... see if that function can help you in how to utilize those two Authorization keys ...

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 Dec 2008, 4:35 PM
#18
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

I am not using an add-on. I just placed new Define Pages into the "Information" sidebox. When customers login, they can view the sidebox and click the protected items in that box. Unfortunately, when they sign up, they are being automatically logged in and can view these links right away.

19 Dec 2008, 4:46 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Sidebox Visible to Logged in Members Only

What file has this header that you posted?

<?php /** * @package page * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: Define Generator v0.1 $ */

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 Dec 2008, 4:55 PM
#20
jeskremer avatar

jeskremer

New Zenner

Join Date:
Nov 2008
Posts:
69
Plugin Contributions:
0

Re: Sidebox Visible to Logged in Members Only

I wish I could delete my post a few posts ago so I don't screw anyone up, but I guess I misread your directions and put the header in includes/modules/pages/CUSTOM PAGE/header_php.php instead of includes/modules/pages/page/header_php.php.