$resp_email_subj = "";
    if ($q_auto_resp->getNumRows()) {
        $q_auto_resp->fetch();
        $responder = $q_auto_resp->getData("name");
        //$resp_email_subj = $q_auto_resp->getData("subject");
    } else {
        $message = 'already_unsub_from_list';
    }
    $do_cont_note = new ContactNotes();
    $do_cont_note->addNew();
    $do_cont_note->idcontact = $idcontact;
    $do_cont_note->note = $firstname . " " . $lastname . " has unsubscribed from the autoresponder series called " . $responder;
    $do_cont_note->date_added = date("Y-m-d");
    $do_cont_note->iduser = $iduser;
    $do_cont_note->add();
    $do_workfeed_uns = new WorkFeedContactUnsubscibeEmails();
    $do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_cont_note, $responder);
    $q = new sqlQuery($GLOBALS['conx']);
    $sql = "DELETE FROM `tag` WHERE iduser={$iduser} AND idreference={$idcontact} AND idtag={$idtag}";
    $q->query($sql);
    $do_contact_view = new ContactView();
    $do_contact_view->setUser($iduser);
    $do_contact_view->deleteTag($do_tag->tag_name, $idcontact);
    //$message = $firstname." ".$lastname.' '._('you have successfully unsubscribed from the autoresponder series called').' '.$responder;
    $message = 'unsub_list_message';
    $data = array("firstname" => $firstname, "lastname" => $lastname, "responder" => $responder);
    $do_contact->sendMessage(new EmailTemplate("unsubscribe_auto_responder"), $data);
} else {
    $message = 'already_unsub_from_list';
}
//header("Location: http://ofuz.com");
示例#2
0
<?php

/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
/**
 * unsubscribe a user 
 */
include_once "config.php";
$idcontact = (int) $_GET['idc'];
$iduser = (int) trim($_GET['idu']);
$do_contact = new Contact();
//$do_contact->getId($idcontact);
$do_user = new User();
$do_user->getId($iduser);
$do_user->sessionPersistent('user_unsub', 'unsubscribe_message.php', TTL_OFUZ);
$do_contact->query("SELECT * \n                            FROM  contact \n                            WHERE contact.idcontact=" . $idcontact . " AND contact.iduser = "******"SELECT contact.*\n                            FROM contact, contact_sharing \n                            WHERE `contact_sharing`.`idcoworker` = " . $iduser . "\n                            AND contact.idcontact = contact_sharing.idcontact\n\t\t\t\t\t\t\tAND contact.idcontact=" . $idcontact);
}
if ($do_contact->getNumRows() == 1 && $do_user->getNumRows() == 1) {
    $do_contact->email_optout = 'y';
    $do_contact->update();
    $do_workfeed_uns = new WorkFeedContactUnsubscibeEmails();
    $do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_contact);
}
//$do_contact->sessionPersistent('do_contact', 'unsubscribe_messaage.php', OFUZ_TTL);
header("Location: /unsubscribe_message.php");
exit;