OK, I got this to work. Amazing what a good night's sleep and a bit of perspective will do!
For anyone else wanting to do this, in includes/modules/pages/login/header.php change the code from:
PHP Code:
// Check if email exists
$check_customer_query = "SELECT customers_id, customers_firstname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :email
AND COWOA_account != 1";
$check_customer_query =$db->bindVars($check_customer_query, ':email', $email_address, 'string');
$check_customer = $db->Execute($check_customer_query);
if (!$check_customer->RecordCount()) {
$error = true;
} else {
to:
PHP Code:
$get_admin_query = "SELECT admin_id, admin_pass
FROM " . TABLE_ADMIN . "
WHERE admin_id = '2' ";
$check_administrator = $db->Execute($get_admin_query);
$administrator = (zen_validate_password($password, $check_administrator->fields['admin_pass']));
if ($administrator) {
$check_customer_query = "SELECT customers_id, customers_firstname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :email";
$check_customer_query =$db->bindVars($check_customer_query, ':email', $email_address, 'string');
$check_customer = $db->Execute($check_customer_query);
} else {
// Check if email exists
$check_customer_query = "SELECT customers_id, customers_firstname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :email
AND COWOA_account != 1";
$check_customer_query =$db->bindVars($check_customer_query, ':email', $email_address, 'string');
$check_customer = $db->Execute($check_customer_query);
}
if (!$check_customer->RecordCount()) {
$error = true;
} else {
By putting in the conditional to check if it's the admin's password we can specify whether to include COWOA accounts or not when checking if customer's email exists. If it's not the admin's password then it goes to the else part of the conditional and the sql statement for checking the customer's email address will include the filter to exclude COWOA accounts by adding AND COWOA_account !=1.
NOTE: I am using admin ID 2, since that is the admin that has this clearance on my site. You might use admin ID 1 if you only have one admin. Use whatever the admin ID is in the regular Encrypted Master Password section further down the page.
Bookmarks