Further Modifications: Users can
also enter an invalid email address when
editing their account details. Based on Martin's instructions above, I made the following modifications.
Tested With: ISC version 4.07
REQUIRES: You must have already added Martin's modified email verification function to general.php
Disclaimers: At your own risk. Make backups. Test before going live.. etc etc.
STEP ONE: You'll be making most of the changes to the class.account.php file
Open:
/includes/classes/class.account.php
======================================
FIND:
Below that, ADD:
Code: Select all
$email_invalid = false; // MOD: Initialize variable. Assume valid email.
=====================================
FIND:
Code: Select all
// Are they updating their email address? If so is the new email address available?
if ($_POST['current_email'] != $_POST['account_email']) {
if ($GLOBALS['ISC_CLASS_CUSTOMER']->AccountWithEmailAlreadyExists($_POST['account_email'])) {
$email_taken = true;
}
}
Below that, ADD:
Code: Select all
// MOD CHECK FOR VALID EMAIL
if (!is_email_address($_POST['account_email'])) {
$email_invalid = true;
}
// MOD END
=====================================
FIND:
Code: Select all
if (!$email_taken && !$phone_invalid) {
*REPLACE* WITH:
Code: Select all
// ORIGINAL CODE: if (!$email_taken && !$phone_invalid) {
// Has been modified to also confirm valid email
if (!$email_taken && !$phone_invalid && !$email_invalid) {
=====================================
FIND:
Code: Select all
else if ($phone_invalid) {
// Phone number is invalid
$this->EditAccount(sprintf(GetLang('AccountUpdateValidPhone'), $_POST['account_phone']), MSG_ERROR);
}
Below that, ADD:
Code: Select all
// MOD EMAIL ADDRESS WAS INVALID
else if ($email_invalid) {
// Email address is invalid
$this->EditAccount(sprintf(GetLang('AccountUpdateEmailInvalid'), $_POST['account_email']), MSG_ERROR);
}
// MOD END
STEP TWO: You'll need to add an additional error message to the language file.
Open:
/language/en/front_language.ini
=====================================
FIND:
Code: Select all
AccountUpdateEmailTaken = "Sorry... The email address '%s' is already in use by another customer. Please enter a different one."
VERSION 1 (Generic Message)
Below that, ADD:
Code: Select all
AccountUpdateEmailInvalid = "<b>Invalid Email:</b> Sorry, there appears to be a problem with the email address you entered. Please double-check to be sure everything is correct.<br/><br/>TIP: Delete any extra spaces at the beginning or end of the email address. Valid email addresses should be in the following format: <i>username@domain.com</i>"
OR... VERSION 2 (Message
includes offending email address)
Below that, ADD:
Code: Select all
AccountUpdateEmailInvalid = "<b>Invalid Email:</b> Sorry, there appears to be a problem with the email address <i>'%s'</i> -- Please double-check to be sure everything is correct.<br/><br/>TIP: Delete any extra spaces at the beginning or end of the email address. Valid email addresses should be in the following format: <i>username@domain.com</i>"
Obviously, use one or the other of these two error messages... but not both... or edit the wording to suit your preferences.
A final note... I've tested this and it appears to work fine on ISC 4.07. I've reviewed these instructions for accuracy, but if you find any typos or errors, please post a correction or let me know and I'll edit this post.
Good luck,
Charlie
PS: Many thanks, Martin!