• Hello, i tried the following code (taken from https://www.eventualo.net/blog/easymail-newsletter-for-developers/#tutorial-customfields) to add new field in subscription form but I cannot save the file functions.php. Which is the error?

    function custom_easymail_set_my_custom_fields ( $fields ) {
     
    	// Custom field: City
    	$fields['cf_city'] = array(
    		'humans_name'		=> __("City", "alo-easymail"),
    		'sql_attr' 		=> "VARCHAR(100) NOT NULL",	
    		'input_type' 		=> "text",
    		'input_mandatory' 	=> true,
    		'input_validation' 	=> false,
    		'input_attr'		=> "maxlength=\"100\""
    	);
    	return $fields;
    }
    add_filter ( 'alo_easymail_newsletter_set_custom_fields', 'custom_easymail_set_my_custom_fields' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author eventualo

    (@eventualo)

    Hi, in which way have you tried to edit the functions.php file? Directly online in dashoboard with theme editor or in which way? Exactly which error message and when you got it?

    Thread Starter webbando

    (@webbando)

    Hello, thanks for reply.

    I found the problem and fix it. The code missing one “,”.

    Now the code is ok:

    function custom_easymail_set_my_custom_fields ( $fields ) {
     
    	// Custom field: City
    	$fields['cf_city'] = array(
    		'humans_name'		=> __("City", "alo-easymail"),
    		'sql_attr' 		=> "VARCHAR(100) NOT NULL",	
    		'input_type' 		=> "text",
    		'input_mandatory' 	=> true,
    		'input_validation' 	=> false,
    		'input_attr'		=> "maxlength=\"100\"",
    	);
    	return $fields;
    }
    add_filter ( 'alo_easymail_newsletter_set_custom_fields', 'custom_easymail_set_my_custom_fields' );

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add more field’ is closed to new replies.