Place this code right under "require('includes/application_top.php');" in unsubscribe_done.php
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_UNSUBSCRIBE);
if (isset($HTTP_GET_VARS['email'])) {
$email_to_unsubscribe = ereg_replace('[^0-9A-Za-z@._-]', '', $HTTP_GET_VARS['email']);
} else {
$email_to_unsubscribe = '';
}
Then place the following code right under " $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_UNSUBSCRIBE, '', 'NONSSL'));" in the same file, unsubscribe_done.php
// Check and see if the email exists in the database, and is subscribed to the newsletter. $cus_subscribe_raw = "select 1 from " . TABLE_CUSTOMERS . " where customers_newsletter = '1' and customers_email_address = '" . $email_to_unsubscribe . "'"; $cus_subscribe_query = tep_db_query($cus_subscribe_raw); $cus_subscribe = tep_db_fetch_array($cus_subscribe_query); // We know that visitor is allready subscirbed $vis_subscribe_raw = "select 1 from " . TABLE_VISITOR . " where email = '" . $email_to_unsubscribe . "'"; $vis_subscribe_query = tep_db_query($vis_subscribe_raw); $vis_subscribe = tep_db_fetch_array($vis_subscribe_query);
Last you need to place this code at a proper place in the same file as above:
<?php
// If we found the customers email address, and they currently subscribe
if ($cus_subscribe) {
// Unsubscribe customer
tep_db_query("update " . TABLE_CUSTOMERS . " set customers_newsletter = '0' where customers_email_address = '" . $email_to_unsubscribe . "'");
?>
<td class="main"><?php echo UNSUBSCRIBE_DONE_TEXT_INFORMATION . $email_to_unsubscribe; ?></td>
<?php
} else if ($vis_subscribe) {
// Unsubscribe visitor
tep_db_query("delete from " . TABLE_VISITOR . " where email = '" . $email_to_unsubscribe . "'");
?>
<td class="smallText"><?php echo UNSUBSCRIBE_DONE_TEXT_INFORMATION . $email_to_unsubscribe; ?></td>
<?php
// Otherwise, we want to display an error message (This should never occur, unless they try to unsubscribe twice)
} else {
?>
<td class="main"><?php echo UNSUBSCRIBE_ERROR_INFORMATION . $email_to_unsubscribe; ?></td>
<?php
}
?>






Find content
Male


