Author Topic: How can I subscribe people to multiple closed lists?  (Read 1870 times)

lynda.kane

  • Posts: 49
    • View Profile
    • http://www.realhealth-online.com
How can I subscribe people to multiple closed lists?
« on: April 20, 2007, 01:47:52 am »
Hi,

We have one open list and (only) IF the person there is UK based I'd like to add them to another closed mailing list, and maybe another depending on their purchase history. Is there a way to refine the 'if user added to this list, add them also to list x and list y' command with an 'if rule' like this based on country?  I'm no php expert by the way! :)

Lynda
Comments from the Energy Awareness Training

"A truly transformational weekend."
"the most EMPOWERING of anything I've done before."
"I didn't realise it was going to change my life!"

www.EAT.energyawareness.org
www.EnergyEgg.com
Tel :  +44 (0)207 617 7521

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
How can I subscribe people to multiple closed lists?
« Reply #1 on: April 22, 2007, 04:13:21 am »
Lynda,

This will take some custom PHP but it might not be too difficult for you to handle.

Unfortunately this will only be possible with an open list unless we add a simple custom modification to signup.php to only allow signups with a password we can add to the URL (below).

The file /xtra/signup-xtra.php will need to be copied to the main ListMail folder to be activated.  

Insert a few lines, utilizing the custom code here, and only executed for signups to chosen lists.

Note that lines starting with // are comments:
Code: [Select]

// execute on list 1 or 2
if($list=='1' || $list=='2'){
 // encode for URL
 $fname2=urlencode($fname);
 $lname2=urlencode($lname);
 // set URL - add user to list 3
 $url = "http://example.com/mail/signup.php?list=3&email=$email&fname=$fname2&lname=$lname2";
 // open URL
 $lmp = fopen($url,'r');
 fclose($lmp);
}
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

lynda.kane

  • Posts: 49
    • View Profile
    • http://www.realhealth-online.com
How can I subscribe people to multiple closed lists?
« Reply #2 on: April 29, 2007, 03:45:27 am »
Hi Dean,

Thanks for your reply. My spam filter bunked the notification - hence my late acknowledgement!

As I said, I'm not a PHP expert, but I can't see in the code you provided where the 'IF this person's country is the UK, add them to list 19' rule part is?

People have to sign up with their country included to the open list. If it's UK, I want them to be added to our general UK mailing list (list 19)

Thanks again for the code.

Lynda
Comments from the Energy Awareness Training

"A truly transformational weekend."
"the most EMPOWERING of anything I've done before."
"I didn't realise it was going to change my life!"

www.EAT.energyawareness.org
www.EnergyEgg.com
Tel :  +44 (0)207 617 7521

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
How can I subscribe people to multiple closed lists?
« Reply #3 on: April 29, 2007, 02:16:14 pm »
Lynda,

Depending on the custom field storing the users' country, the code might look like as follows (example for custom field #1):
Code: [Select]
// execute on list 1 or 2
if($list=='1' || $list=='2'){
 if($user1=='UK'){
  // encode for URL
  $fname2=urlencode($fname);
  $lname2=urlencode($lname);
  // set URL - add user to list 3
  $url = "http://example.com/mail/signup.php?list=3&email=$email&fname=$fname2&lname=$lname2";
  // open URL
  $lmp = fopen($url,'r');
  fclose($lmp);
 }
}

Both lists must be open for this unless we modify signup.php a little and change the code to include a secret password to bypass the closed list...
Code: [Select]
// execute on list 1 or 2
if($list=='1' || $list=='2'){
 if($user1=='UK'){
  // encode for URL
  $fname2=urlencode($fname);
  $lname2=urlencode($lname);
  // set URL - add user to list 3
  $url = "http://example.com/mail/signup.php?list=3&email=$email&fname=$fname2&lname=$lname2&secret=zJ69Eb4S";
  // open URL
  $lmp = fopen($url,'r');
  fclose($lmp);
 }
}

Then in signup.php... change this:
Code: [Select]
// check closed lists
while(list($key,$list)=each($lists)){
 $listopts = getlistopts($list);
 if($listopts[0]==1){
  $closed[$list] = 1;
  if(!in_array($list,$badlists)) $badlists[] = $list;
 }
}
reset($lists);

to this:
Code: [Select]
// check closed lists
while(list($key,$list)=each($lists)){
 $listopts = getlistopts($list);
 if($listopts[0]==1 && $secret<>'zJ69Eb4S'){
  $closed[$list] = 1;
  if(!in_array($list,$badlists)) $badlists[] = $list;
 }
}
reset($lists);

Unfortunately, unless I were to base the password on the Dailymail password, this change will be overwritten by updates.
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting