Jump to content
X2Community Forums

Scheduled Campaigns do not honor unsubscribed campaign category

Recommended Posts

X2CRM version 8.0


Scenario 1:

A contact unsubscribes from a specific campaign category email, such as Marketing. The contact email address is then listed in the appropriate x2_list_items table as unsubscribed.


Create a new campaign with the Marketing category specified.  Include the Contact that has unsubscribed in the contact list for the campaign.


Launch the campaign from the interface by clicking the 'Launch' button.


The result of this is the contact is not emailed because they have already unsubscribed.  THIS IS THE EXPECTED RESULT


Scenario 2:

Same as above except schedule the campaign for some time in the future.


When the campaign fires, the result is the contact is emailed.  UNEXPECTED RESULT

Link to post
Share on other sites

Thank you for the bug report rordallas,

I have writen a fix that will now be in the next update.



If you need it now add this function to "protected/modules/marketing/models/Campaign.php

    //check to make sure unsubscribe list exsist, if not make the list
    public static function checkUnsubList($Category) {
        $FullName = 'Unsubscribe_' . $Category . '_X2_internal_list';
        $list = CActiveRecord::model('X2List')
                        ->findByAttributes(array('name' => $FullName));
        if (empty($list)){
            $NewUNSub = new X2List;
            $NewUNSub->modelName = 'Contacts';
            $NewUNSub->type = 'UnSubscribe';
            $NewUNSub->assignedTo = 'Anyone';
            $NewUNSub->visibility = 1;
            $NewUNSub->name = $FullName;
            $NewUNSub->nameId = $FullName;
            $NewUNSub->createDate = time();
            $NewUNSub->lastUpdated = time();
            $NewUNSub->logicType = 'AND';

and add to the file protected/modules/marketing/components/CampaignMailingBehavior.php

                        //check catagory
                        $FullName = 'Unsubscribe_' . $campaign->category . '_X2_internal_list';
                        $catlist = CActiveRecord::model('X2List')->findByAttributes(array('name' => $FullName));
                        $campaign->categoryListId = $catlist->id;
under the line 
                                          if($newList->save()) {
in the function 
                             public static function sendMail($id = null, $t0 = null)
Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...