Lasso Soft Inc. > Home

[12all]

Link12all
AuthorBrian Loomis
CategoryCustom Tag
Version8.x
LicensePublic Domain
Posted06 Jun 2009
Updated05 Aug 2009
More by this author...

Description

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

Sample Usage

');
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;

?>

Source Code

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;

?>

Related Tags

Comments

08 Mar 2010, Peter D Bethke

Requires autoctype

Looking through the code, it looks as if it relies on autoctype - this is listed as related but should be noted in the comments or description, or maybe add a -critera in an oncreate().

05 Aug 2009, Brian Loomis

Updated August 5, 2009

I've fixed a condition where the tag will fail when a subscribe and unsubscribe condition are present, before the tags in the type for subscribe and unsubscribe did not respect the conditions in each table and could get out of sync if the members of lists subscribe or unsubscribe from other sources like the real public unsubscribe page of the 12all software. This version corrects the dependence of the 12all custom type to always use itself to continue to work properly.

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft