• Resolved mferris

    (@mferris)


    Hi,

    When someone checks the ‘Add me to the newsletter’ it will subscribe them to my list no problem. The issue is that will only put the First Name and Last Name in to my mailchimp list, it does not add in the Company Name or any other field.

    There must a place in the code to add in these other fields, right? I use another plugin (Cimy User Extra Fields) to add extra fields to my registration page. I know their field label but cant figure out where in the code I declare them.

    Any help would be great!

    Mike

    https://www.ads-software.com/plugins/mailchimp-for-wp/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Mike,

    You can add this to the data sent to MailChimp but because it is near to impossible for the plugin to guess the field names you will have to use a filter function to accomplish this. Are you comfortable adding a few lines of code to your functions.php file?

    The filter name is mc4wp_merge_vars. If you’ve never heard of filters I’d be happy to help you out, just point me to your registration url and I will help you write the code snippet. ??

    Thread Starter mferris

    (@mferris)

    Thanks a lot for your help! The registration page is here: https://www.deltaind.net/wp-login.php?action=register.

    In general I am comfortable adding code in but if you could show me how to do it, it would be great.

    Thread Starter mferris

    (@mferris)

    Hi Danny,

    I’ve tried using the filter myself but I have had no success. I’m not ashamed to admit that I have no idea how to use it. I would appreciate any help you could give.

    Mike

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Mike,

    I will take a look at it tomorrow, it’s a little late here now (Europe). I’ll let you know!

    Thread Starter mferris

    (@mferris)

    Thanks a lot!

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Mike,

    Adding the following code to your theme its functions.php should work!

    function my_merge_vars($merge_vars) {
    
    	if(isset($_POST['cimy_uef_COMPANYNAME'])) {
    		$merge_vars['COMPANYNAME'] = $_POST['cimy_uef_COMPANYNAME'];
    	}
    
    	if(isset($_POST['cimy_uef_PHONE'])) {
    		$merge_vars['PHONE'] = $_POST['cimy_uef_PHONE'];
    	}
    
    	return $merge_vars;
    }
    
    add_filter('mc4wp_merge_vars', 'my_merge_vars');

    Hope that helps!

    Thread Starter mferris

    (@mferris)

    I hate bugging you but it seems when I copy this code into my functions.php it crashes my site. I hit ‘Update File’ and I get a blank white screen.

    I’m using the Udesign theme if that’s any help. Any idea what I could be going wrong?

    Again, thanks for all of your help.

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Mike,

    That sounds like a syntax error.

    Where are you adding the snippet? It should be inside (or after) a <?php tag, inside your functions.php.

    Thread Starter mferris

    (@mferris)

    Yep, I drop it in just after the first <?php tag at the top. I’m guessing that it should not do that, even if the function itself was not going to work

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Mike,

    Can you double-check if you copied the complete snippet?

    It might also be that a function with that name already exists, which is unlikely but you never know. Just in case, try this one..

    function my123_merge_vars($merge_vars) {
    
    	if(isset($_POST['cimy_uef_COMPANYNAME'])) {
    		$merge_vars['COMPANYNAME'] = $_POST['cimy_uef_COMPANYNAME'];
    	}
    
    	if(isset($_POST['cimy_uef_PHONE'])) {
    		$merge_vars['PHONE'] = $_POST['cimy_uef_PHONE'];
    	}
    
    	return $merge_vars;
    }
    
    add_filter('mc4wp_merge_vars', 'my123_merge_vars');
    Thread Starter mferris

    (@mferris)

    Same result. Could the u-design theme be messing with your code?

    I realise that this is outside of the scope of your started help with the plugin and I’m very grateful for your input.

    Thread Starter mferris

    (@mferris)

    Figured the error out, when I copied your snippet and pasted it the ‘ was changed to &#039. It was right in front of my eyes all along.

    I’ll let you know if I get the merge values working ??

    Thread Starter mferris

    (@mferris)

    Works like a dream, thank you so much for your help!

    Plugin Author Danny van Kooten

    (@dvankooten)

    Awesome, thanks for the update Mike. Glad it works!

    If you have a quick minute, a review on the plugin would make me really happy. ??

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Checkbox on registration page’ is closed to new replies.