WPPizza Mailinglists

Customisations of selected WPPizza Mailinglists

Freshmail

@param: array
@return: array

/*
Adding preconfigured custom fields
*/
add_filter('wppizza_mll_freshmail_custom_fields', 'myprefix_freshmail_customfields');
function myprefix_freshmail_customfields($custom_fields){ 
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Name Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "name" - type text. (The tag will be $$name$$)
		c) Set  $custom_fields['name'] below to boolean true to enable. 
	*/
	$custom_fields['name'] = false;
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Phone Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "phone" - type text. (The tag will be $$phone$$)
		c) Set  $custom_fields['phone'] below to boolean true to enable.
	*/
	$custom_fields['phone'] = false;
	
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Address Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "address" - type text. (The tag will be $$address$$)
		c) Set $custom_fields['address'] below to boolean true to enable.
	*/
	$custom_fields['address'] = false;

return $custom_fields;
}

Note: As of writing there’s a bug (known to Freshmail) – in the api that does not allow to fill the “name” field that exists by default associated to an email address.
If you need to avoid confusion (perhaps by using something like “Full Name” instead of using ‘name’ in the preconfigured filter above), use the full filter below instead to use a “Full Name” custom field for example (or any other custom filed you would like to add)

@param: array
@return: array

/*
Example, adding a full name custom field.
*/
add_filter('wppizza_mll_freshmail_parameters ', 'myprefix_freshmail_parameters', 10 ,  2);
function myprefix_freshmail_parameters($parameters, $customer_data){ 

	/*
		a) Create a customfield  - type text - for your selected mailinglist with a "Field Name" of "Full Name". (The tag will be $$full_name$$)
		b) Add the a $custom_fields['full_name'] like so . 
	*/
	$parameters['custom_fields']['full_name'] = (!empty($customer_data['name']) ? $customer_data['name'] : '' );//Set full name from customer_data parameters
	

return $parameters;
}