Link | 12all |
Author | Brian Loomis |
Category | Custom Tag |
Version | 8.x |
License | Public Domain |
Posted | 06 Jun 2009 |
Updated | 05 Aug 2009 |
More by this author... |
The 1-2All type allows several simple methods to interface with the 1-2All email marketing software. 1-2all maintains two tables, one for subscribes and one for unsubscribes. At this time the type supports on some simple options for subscribing and unsubscribing. I've left the tags in the type to output the SQL that's generated, so you might want to remove them after you are done testing. Also a couple of the parameters have some foreign key in the nl column, which could be the list ID, test your subscriptions and find out what real subscriptions look like in your SQL tables and adjust. The ID also returns an array if the email address is in the 1-2all system more than once. Emails are non distinct in 1-2all as the user tables can contain a foreign key for different lists that address is subscribed to. Brian
'); var:'tsdb' = '12all'; 12all->(is_subscribed:'sample@xxx.edu'); $br; 12all->(is_unsubscribed:'sample@xxx.edu'); $br; 12all->(unsubscribe:'sample@xxx.edu'); $br; 12all->(subscribe:'sample@xxx.edu','John'); $br; ?>
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
insert(column('id')); /rows; return: #ids_from_email; /inline; /define_tag; /**************************************************************************** This checks the 12all unsubscribed table for instances of the email address *****************************************************************************/ define_tag:'id_from_email_unsubscribed', -required='email'; local('ids_from_email')=array; inline: $dbconn2, -table='12all_listmembersu', -op='EQ', 'em'=#email, -Search; rows; #ids_from_email->insert(column('id')); /rows; return: #ids_from_email; /inline; /define_tag; /**************************************************************************** Is in subscribed can return one or zero *****************************************************************************/ define_tag:'is_subscribed', -required='email'; inline: $dbconn2, -table='12all_listmembers', -op='EQ', 'email'=#email, -Search; //return: found_count; return:action_statement; (found_count > 0) ? return:1 | return:0; /inline; /define_tag; /**************************************************************************** Is in unsubscribed can return one or zero *****************************************************************************/ define_tag:'is_unsubscribed', -required='email'; inline: $dbconn2, -table='12all_listmembersu', -op='EQ', 'em'=#email, -Search; (found_count > 0) ? return:1 | return:0; /inline; /define_tag; /**************************************************************************** Subscribe a Person to 12all *****************************************************************************/ define_tag:'subscribe', -required='email', -required='name'; local('result_string'=string); //return: self->is_subscribed(#email); inline($dbconn2); if(self->is_unsubscribed(#email) == 1); local('listmemberu_del') = (autoctype(-table='12all_listmembersu',-id=(self->(id_from_email_unsubscribed(#email)->first)))); #listmemberu_del->delete; #result_string += #listmemberu_del->code; /if; if(self->is_subscribed(#email) != 1); local('listmember') = (autoctype(-table='12all_listmembers')); #listmember->sip='Synced'; #listmember->comp='Synced'; #listmember->sdate=(date_format:date,-format='%Q'); #listmember->email=#email; #listmember->name=#name; #listmember->bounced=0; #listmember->soft_bounced=0; #listmember->bounced_d='0000-00-00'; #listmember->active=0; #listmember->nl=5; #listmember->stime=(date_format:date,-format='%T'); #listmember->respond=''; #listmember->last_send=0; #listmember->no_autoresponders=0; #listmember->sync=1; #listmember->subscription_form_id=0; #listmember->save; #result_string += #listmember->code; /if; /inline; if(#result_string != ''); return: #result_string; else; return(false); /if; /define_tag; /**************************************************************************** Unsubscribe a Person to 12all *****************************************************************************/ define_tag:'unsubscribe', -required='email'; local('result_string'=string); inline($dbconn2); if(self->is_subscribed(#email) == 1); local('listmember_del') = (autoctype(-table='12all_listmembers',-id=(self->(id_from_email_subscribed(#email)->first)))); #listmember_del->delete; #result_string += #listmember_del->code; /if; if(self->is_unsubscribed(#email) != 1); local('listmemberu') = (autoctype(-table='12all_listmembersu')); #listmemberu->em=#email; #listmemberu->reason=1; #listmemberu->nl=5; #listmemberu->date=(date_format:date,-format='%Q %T'); #listmemberu->date_subscribed=(date_format:date,-format='%Q'); #listmemberu->reason=''; #listmemberu->mesg_id=''; #listmemberu->respond_id=''; #listmemberu->b=0; #listmemberu->time_subscribed=(date_format:date,-format='%T'); #listmemberu->subscribe_ip=''; #listmemberu->save; #result_string += #listmemberu->code; /if; /inline; if(#result_string != ''); return: #result_string; else; return(false); /if; /define_tag; /define_type; ?>
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Requires autoctype