It turns out that three files require change for this to work properly; changes highlighted in red:
/includes/classes/class.phpbb.php:
Code:
function phpbb_check_for_duplicate_email($email_address, $nick='') {
if ($this->phpBB['installed'] != true) return false;
$status='';
$check_nick = ($nick == '') ? '' : " AND username != '" . $nick . "'";
$sql = "select * from " . $this->phpBB['users_table'] . " where user_email = '" . $email_address . "'" . $check_nick;
$phpbb_users = $this->db_phpbb->Execute($sql);
if ($phpbb_users->RecordCount() > 0 ) {
$status='already_exists';
}
return $status;
}
/includes/modules/pages/account_edit/header_php.php, starting at line 70:
Code:
$check_email_query = "SELECT count(*) AS total
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :emailAddress
AND customers_id != :customersID";
$check_email_query = $db->bindVars($check_email_query, ':emailAddress', $email_address, 'string');
$check_email_query = $db->bindVars($check_email_query, ':customersID', $_SESSION['customer_id'], 'integer');
$check_email = $db->Execute($check_email_query);
if ($check_email->fields['total'] > 0) {
$error = true;
$messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}
// check phpBB for duplicate email address
if ($phpBB->phpbb_check_for_duplicate_email(zen_db_input($email_address), zen_db_input($_POST['nick'])) == 'already_exists' ) {
$error = true;
$messageStack->add('account_edit', 'phpBB-'.ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}
// }
and then towards the end of the file:
Code:
$account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
customers_dob, customers_email_address, customers_telephone,
customers_fax, customers_email_format, customers_referral, customers_nick
FROM " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab
WHERE c.customers_id = :customersID
AND ab.customers_id = c.customers_id";
and finally, /includes/templates/template_default/templates/tpl_account_edit_default.php, line 16:
Code:
<?php echo zen_draw_form('account_edit', zen_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'), 'post', 'onsubmit="return check_form(account_edit);"') . zen_draw_hidden_field('action', 'process') . zen_draw_hidden_field('nick', $account->fields['customers_nick']); ?>