I'm attempting to integrate my GDPR customisations (I think they were from JSWeb's mod) into ZC v1.5.8. In /includes/modules/MY_TEMPLATE/create_account.php
I have, in ZC v1.5.7d, the additional code in red
Code:
if ($error == true) {
// hook notifier class
$zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
} elseif ($antiSpam != '') {
$zco_notifier->notify('NOTIFY_SPAM_DETECTED_DURING_CREATE_ACCOUNT');
$messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
} else {
$sql_data_array = array(array('fieldName'=>'customers_firstname', 'value'=>$firstname, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_lastname', 'value'=>$lastname, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_email_address', 'value'=>$email_address, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_nick', 'value'=>$nick, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_telephone', 'value'=>$telephone, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_fax', 'value'=>$fax, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_newsletter', 'value'=>$newsletter, 'type'=>'integer'),
array('fieldName'=>'customers_email_format', 'value'=>$email_format, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_default_address_id', 'value'=>0, 'type'=>'integer'),
array('fieldName'=>'gdpr_accept', 'value'=>$gdpr_accept, 'type'=>'integer'),
array('fieldName'=>'gdpr_accept_date', 'value'=>date('Y-m-d H:i:s'), 'type'=>'date'),
array('fieldName'=>'customers_password', 'value'=>zen_encrypt_password($password), 'type'=>'stringIgnoreNull'),
array('fieldName'=>'customers_authorization', 'value'=>$customers_authorization, 'type'=>'integer'),
);
if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) $sql_data_array[] = array('fieldName'=>'customers_referral', 'value'=>$customers_referral, 'type'=>'stringIgnoreNull');
if (ACCOUNT_GENDER == 'true') $sql_data_array[] = array('fieldName'=>'customers_gender', 'value'=>$gender, 'type'=>'stringIgnoreNull');
if (ACCOUNT_DOB == 'true') $sql_data_array[] = array('fieldName'=>'customers_dob', 'value'=>empty($_POST['dob']) || $dob_entered == '0001-01-01 00:00:00' ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_date_raw($_POST['dob']), 'type'=>'date');
$db->perform(TABLE_CUSTOMERS, $sql_data_array);
$_SESSION['customer_id'] = $db->Insert_ID();
$zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD', array_merge(array('customer_id' => $_SESSION['customer_id']), $sql_data_array));
$sql_data_array = array(array('fieldName'=>'customers_id', 'value'=>$_SESSION['customer_id'], 'type'=>'integer'),
array('fieldName'=>'entry_firstname', 'value'=>$firstname, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'entry_lastname', 'value'=>$lastname, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'entry_street_address', 'value'=>$street_address, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'entry_postcode', 'value'=>$postcode, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'entry_city', 'value'=>$city, 'type'=>'stringIgnoreNull'),
array('fieldName'=>'entry_country_id', 'value'=>$country, 'type'=>'integer'),
);
if (ACCOUNT_GENDER == 'true') $sql_data_array[] = array('fieldName'=>'entry_gender', 'value'=>$gender, 'type'=>'stringIgnoreNull');
if (ACCOUNT_COMPANY == 'true') $sql_data_array[] = array('fieldName'=>'entry_company', 'value'=>$company, 'type'=>'stringIgnoreNull');
if (ACCOUNT_SUBURB == 'true') $sql_data_array[] = array('fieldName'=>'entry_suburb', 'value'=>$suburb, 'type'=>'stringIgnoreNull');
if (ACCOUNT_STATE == 'true') {
if ($zone_id > 0) {
$sql_data_array[] = array('fieldName'=>'entry_zone_id', 'value'=>$zone_id, 'type'=>'integer');
$sql_data_array[] = array('fieldName'=>'entry_state', 'value'=>'', 'type'=>'stringIgnoreNull');
} else {
$sql_data_array[] = array('fieldName'=>'entry_zone_id', 'value'=>0, 'type'=>'integer');
$sql_data_array[] = array('fieldName'=>'entry_state', 'value'=>$state, 'type'=>'stringIgnoreNull');
}
}
$db->perform(TABLE_ADDRESS_BOOK, $sql_data_array);
$address_id = $db->Insert_ID();
$zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD', array_merge(array('address_id' => $address_id), $sql_data_array));
$sql = "UPDATE " . TABLE_CUSTOMERS . "
SET customers_default_address_id = '" . (int)$address_id . "'
WHERE customers_id = '" . (int)$_SESSION['customer_id'] . "'";
$db->Execute($sql);
$sql = "INSERT INTO " . TABLE_CUSTOMERS_INFO . "
(customers_info_id, customers_info_number_of_logons,
customers_info_date_account_created, customers_info_date_of_last_logon)
VALUES ('" . (int)$_SESSION['customer_id'] . "', '1', now(), now())";
$db->Execute($sql);
// do any 3rd-party nick creation
$nick_email = $email_address;
$zco_notifier->notify('NOTIFY_NICK_CREATE_NEW', $nick, $password, $nick_email, $extra_welcome_text);
if (SESSION_RECREATE == 'True') {
zen_session_recreate();
}
$_SESSION['customer_first_name'] = $firstname;
$_SESSION['customer_last_name'] = $lastname;
$_SESSION['customer_default_address_id'] = $address_id;
$_SESSION['customer_country_id'] = $country;
$_SESSION['customer_zone_id'] = $zone_id;
$_SESSION['customers_authorization'] = $customers_authorization;
// restore cart contents
$_SESSION['cart']->restore_contents();
// hook notifier class
$zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT', $email_address, $extra_welcome_text, $send_welcome_email);
in ZC v1.5.8 that part of the create_account.php file now reads
Code:
if ($error == true) {
// hook notifier class
$zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
} elseif ($antiSpam != '') {
$zco_notifier->notify('NOTIFY_SPAM_DETECTED_DURING_CREATE_ACCOUNT');
$messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
} else {
$ip_address = zen_get_ip_address();
$customer = new Customer;
$data = compact(
'firstname', 'lastname', 'email_address', 'nick', 'email_format', 'telephone', 'fax',
'newsletter', 'password', 'customers_authorization', 'customers_referral',
'gender', 'dob', 'company', 'street_address',
'suburb', 'city', 'zone_id', 'state', 'postcode', 'country', 'ip_address'
);
$result = $customer->create($data);
if (!empty($result)) {
$customer->login($result['customers_id'], $restore_cart = true);
if (SESSION_RECREATE == 'True') {
zen_session_recreate();
}
}
// do any 3rd-party nick creation
$nick_email = $email_address;
$zco_notifier->notify('NOTIFY_NICK_CREATE_NEW', $nick, $password, $nick_email, $extra_welcome_text);
// hook notifier class
$zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT', $email_address, $extra_welcome_text, $send_welcome_email);
How do I incorporate my gdpr code into the new ZC v1.5.8 code? I had thought that something like this might be appropriate
Code:
$data = compact(
'firstname', 'lastname', 'email_address', 'nick', 'email_format', 'telephone', 'fax',
'newsletter', 'gdpr_accept', 'gdpr_accept_date', 'password', 'customers_authorization', 'customers_referral',
'gender', 'dob', 'company', 'street_address',
'suburb', 'city', 'zone_id', 'state', 'postcode', 'country', 'ip_address'
);
but am not sure if that works for 'gdpr_accept_date' with its value of 'date'.
Bookmarks