Hi,
Thanks again for the replies. I have solved the probem, but first I'll state what the problem was before I give the solution.
Problem
I needed to prevent all customers accessing customer accounts in the shop. This is because admins will log in through the admin section, phone up customers and then log in to the shop for the customer. So, the customer should never be able to log in.
Admins are defined as those logging on through the admin section and whose usernames/passwords are held in the zen_admin table. 'Customer' accounts are defined as those held in the zen_customers table (assuming that 'zen_' is your table prefix).
The solution was to intercept calls to the shop pages at the earliest opportunity and redirect to the admin log in page if the user had not already logged in as an admin. Two different session ids are used: 'zenAdminID' for admin; and 'zenid' for the shop. If the user has already logged in via the admin section, then the session variable 'admin_id' will be present in the 'zenAdminID' session.
Solution
- To ensure that all pages in the cart require an admin login before they can be accessed the following must be done:
Copy the following file:
includes\init_includes\init_sessions.php
to
includes\init_includes\overrides\init_sessions.php
Add the following to the new file:
/**
- require the session handling functions
*/
require(DIR_WS_FUNCTIONS . 'sessions.php');
/**
- START OF CUSTOMISATION
- Check if the user has already logged on throught the admin secion.
- If not, do not allow access, and redirect to the admin log in page.
- Otherwise restore the shop session ('zenid').
*/
zen_session_name('zenAdminID');
zen_session_start();
if( null == $_SESSION['admin_id'] ) {
print "lilnk = " . zen_href_link("/" . FILENAME_ADMIN);
header( 'Location: /admin/index.php' ) ;
}
/*
/**
- set the session name and save path
*/
zen_session_name('zenid');
Hope this a help to folk in the future.