Double-Opt-In with Multiple Mailing Lists

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

coderoyal
Posts: 1
Joined: Mon Feb 15, 2010 2:45 pm

Double-Opt-In with Multiple Mailing Lists

Post by coderoyal »

Hi everyone,

I've been working on this for the whole day and have been browsing the boards for a solution. However I haven't been able to find a way here to make it possible to use the Double-Opt-In with Mutiple Mailing Lists.

However, I've been able to find a way to do this by piecing suggestions on the forum here in a working solution. I know there are many here that have been struggling to get this to work, so I'll explain to the best of my ability what I did. Please forgive me if I'm not clear, I'm not a programmer nor am I an expert with the software.

Summarization:

This is the process I went through to allow me to create a working form that allows users to subscribe to multiple mailing lists, and be able to subscribe using the Double-Opt-In feature (email confirmation). This is done one 6.0.1 (Vmware edition).

In order for this to work, I have no choice but to subscribe all users to the default built-in maillist (Mailing List 1) that is included. However, I don't intend to use this maillist for any other purpose so I don't forsee a problem with this.

To start, I edited the default en_doi form with the following:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<head>
<title>Newsletter Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
body, table { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px; }
h1 { font-family: Tahoma, Helvetica, sans-serif; font-size: 16px; }
select, input { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px;}      
select { width: 200px; }
-->
</style>
</head>

<body bgcolor="#C0C0C0" link="#bb2233" vlink="#bb2233" alink="#bb2233">
<table width="480" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr bgcolor="#808080">
    <td bgcolor="#808080">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr>
          <td>
          <form action="form.do">
          <input type="hidden" name="agnCI" value="1">
          <input type="hidden" name="agnFN" value="en_doi_confirm">
          <input type="hidden" name="MAILTYPE" value="0">
          <input type="hidden" name="agnMAILINGLIST" value="1">
          <input type="hidden" name="agnMAILINGLIST2" value="2">    
          <input type="hidden" name="agnMAILINGLIST3" value="3"> 
          <input type="hidden" name="agnMAILINGLIST4" value="4"> 
          <input type="hidden" name="agnMAILINGLIST5" value="5"> 
          <input type="hidden" name="agnMAILINGLIST6" value="6"> 
          <input type="hidden" name="agnMAILINGLIST7" value="7"> 
          <input type="hidden" name="agnMAILINGLIST8" value="8"> 
          <input type="hidden" name="agnMAILINGLIST9" value="9"> 
          <input type="hidden" name="agnMAILINGLIST10" value="10"> 
          <input type="hidden" name="agnMAILINGLIST11" value="11"> 
          <input type="hidden" name="agnSUBSCRIBE" 
value="1">
          <table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3">&nbsp;</td>
            </tr>            
            <tr>
              <td width="8">&nbsp;</td>
              <td width="460" rowspan="2"><h1 align="center">Newsletter Registration</h1>
                  <p>Please fill the form below to subscribe to the newsletter:</p>
                  <table border=0>
                  <tr>
                      <td width="120">Salutation:</td>
                      <td width="341"><select name="GENDER">
                            <option value="2" selected>Unspecified</option>
                            <option value="1">Ms.</option>
                            <option value="0">Mr.</option>
                        </select></td></tr>
                  <tr>
                      <td>First Name:</td>
                      <td><input type="text" name="FIRSTNAME" style="width: 200px;"></td></tr>
                  <tr>
                      <td>Last Name:</td>
                      <td><input type="text" name="LASTNAME" style="width: 200px;"></td></tr>
                  <tr>
                      <td>E-Mail:</td>
                      <td><input type="text" name="EMAIL" style="width: 200px;"></td></tr><tr><td colspan="2">
                        <p>
  <!-- list of mailings --> 
  Available Newsletter Subscriptions:</p>
                        <p>General Announcements
                          <input type="checkbox" name="agnSUBSCRIBE11" 
value="1">
                        </p>
                        <p>News that pertains to all of the gymnasts. Also announcements that apply to all of the websites, and announcements of new gymnast websites opening.</p>
                        <p>                          Gymnast Websites:<br>
                          Anna Pavlova Online
                            <input type="checkbox" name="agnSUBSCRIBE2" 
value="1" id="agnSUBSCRIBE2"><br> 
                           
                          Aliya Mustafina Online
                          <input type="checkbox" name="agnSUBSCRIBE3" 
value="1" id="agnSUBSCRIBE3">
                          <br>
                          Anna Myzdrikova Online
                          <input type="checkbox" name="agnSUBSCRIBE4" 
value="1">
                          <br>
                          Diana Sapronova Online
                          <input type="checkbox" name="agnSUBSCRIBE5" 
value="1">
                          <br>
                          Ekaterina Kramarenko Online
                          <input type="checkbox" name="agnSUBSCRIBE6" 
value="1">
                          <br>
                          Ksenia Semenova Online
                          <input type="checkbox" name="agnSUBSCRIBE7" 
value="1">
                          <br>
                          Svetlana Klyukina Online
                          <input type="checkbox" name="agnSUBSCRIBE8" 
value="1">
                          <br>
                          Tatiana Nabieva Online
                          <input type="checkbox" name="agnSUBSCRIBE9" 
value="1">
                          <br>
                          Viktoria Komova Online
                          <input type="checkbox" name="agnSUBSCRIBE10" 
value="1">
<br> 
                        </p></td></tr>
                  <tr><td><input type="submit" value="Send"></td>
                      <td><input type="reset" value="Cancel" onClick="javascript:history.back();"></td></tr>
                  </table>         
                  </td>                                 
              <td width="8">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>            
          </table>
          </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
I added all of my mailing lists into the default form. The most important thing is to be sure that users are subscribed to the default mailist by having <input type="hidden" name="agnSUBSCRIBE"
value="1"> inserted.

After this is done, save the form. The next step is to go to Actions in the control panel, then edit the doi_user_confirm action.

The changes to make are:

Add a second step to "Load Reciepient Data."

Be sure that "Load even if customer is not a active subscriber " is selected.

Add a third step, to include Script Action. Enter the below code (with amendments mentioned below):

Code: Select all

## Maillist 1 
$BindingEntry.setMailinglistID(1) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(2) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(3) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(4) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(5) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(6) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(7) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(8) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(9) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(10) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 

## Maillist 2 
$BindingEntry.setMailinglistID(11) 
$BindingEntry.setCustomerID($customerID) 

#if($BindingEntry.getUserBindingFromDB(1) == true) 
   #if($BindingEntry.getUserStatus() == 5) 
        $BindingEntry.setUserStatus(1) 
        $BindingEntry.setUserRemark("Opt-in by User") 
        $BindingEntry.updateStatusInDB(1) 
   #end 
#end 


#set($scriptResult = "1") 
As I understand it, this will go through after the user clicks the subscription confirmation link, and subscribe the users to all of the mail lists that they signed up for. In short, it changes any subscriptions in the "Waiting for Confirmation" script, and changes them to the Active "Opt-in by User" condition.

If you look at the script, there's 11 entries. One for each mailing list. You will want to be sure you have the correct amount for the mailing lists that you have.

Anyhow, I hope this helps others that are trying to accomplish the same thing! If you have questions, I probably can't really answer them, but I can certainly try.

Good luck!
Alan
nterry
Posts: 24
Joined: Thu Nov 01, 2012 5:18 pm

Re: Double-Opt-In with Multiple Mailing Lists

Post by nterry »

Alan

Thanks! That's brilliant. I got it working really easily, thanks for doing the work of sorting it out

Nigel
sr-ska
Posts: 22
Joined: Tue Mar 19, 2013 6:56 pm

Re: Double-Opt-In with Multiple Mailing Lists

Post by sr-ska »

It's working for me, but I get the following message when I klick on the e-mail link: "NEWSLETTER REGISTRATION ERROR"
I hope you can help me with that, thx!
Post Reply