Viewing 14 replies - 16 through 29 (of 29 total)
  • did that work for you splitmango? I tried this and it doesn’t add the email to campaign monitor, I have just tried it again on the most recent version of cf7 and it still doesn’t work for me?

    This has affected 2 of my sites. Just putting my comment in to see if someone will come up with a solution and post it here.

    solution is to replace function function wpcf7_cm_subscribe($obj) with updated contact form 7 code. i.e use following code. it will be on line 161 of cf7-campaignmonitor.php

    function wpcf7_cm_subscribe($obj)
    {
    	$cf7_cm = get_option( 'cf7_cm_'.$obj->id() );
    	$submission = WPCF7_Submission::get_instance();
    
    	if( $cf7_cm )
    	{
    		$subscribe = false;
    
    		$regex = '/\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\]/';
    		$callback = array( &$obj, 'cf7_cm_callback' );
    
    		$email = cf7_cm_tag_replace( $regex, $cf7_cm['email'], $submission->get_posted_data() );
    		$name = cf7_cm_tag_replace( $regex, $cf7_cm['name'], $submission->get_posted_data() );
    
    		$lists = cf7_cm_tag_replace( $regex, $cf7_cm['list'], $submission->get_posted_data() );
    		$listarr = explode(',',$lists);
    
    		if( isset($cf7_cm['accept']) && strlen($cf7_cm['accept']) != 0 )
    		{
    			$accept = cf7_cm_tag_replace( $regex, $cf7_cm['accept'], $submission->get_posted_data() );
    			if($accept != $cf7_cm['accept'])
    			{
    				if(strlen($accept) > 0)
    					$subscribe = true;
    			}
    		}
    		else
    		{
    			$subscribe = true;
    		}
    
    		for($i=1;$i<=20;$i++){
    
    			if( isset($cf7_cm['CustomKey'.$i]) && isset($cf7_cm['CustomValue'.$i]) && strlen(trim($cf7_cm['CustomValue'.$i])) != 0 )
    			{
    				$CustomFields[] = array('Key'=>trim($cf7_cm['CustomKey'.$i]), 'Value'=>cf7_cm_tag_replace( $regex, trim($cf7_cm['CustomValue'.$i]), $submission->get_posted_data() ) );
    			}
    
    		}
    
    		if( isset($cf7_cm['resubscribeoption']) && strlen($cf7_cm['resubscribeoption']) != 0 )
    		{
    			$ResubscribeOption = true;
    		}
    			else
    		{
    			$ResubscribeOption = false;
    		}
    
    		if($subscribe && $email != $cf7_cm['email'])
    		{
    
    			require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'csrest_subscribers.php');
    
    			$wrap = new CF7CM_CS_REST_Subscribers( trim($listarr[0]), $cf7_cm['api'] );
    			foreach($listarr as $listid)
    			{
    				$wrap->set_list_id(trim($listid));
    				$wrap->add(array(
    					'EmailAddress' => $email,
    					'Name' => $name,
    					'CustomFields' => $CustomFields,
    					'Resubscribe' => $ResubscribeOption
    				));
    			}
    
    		}
    
    	}
    }
    Dave James Miller

    (@davejamesmiller)

    Thank you fmzac, that works well!

    Dan Stramer

    (@danstramer)

    Hi Guys, I also ran into this issue a while back and being a campaign monitor user and a WordPress developer for my clients this is a real drawback.
    I have a suggestion – how about if each of us on this thread donate 15$ to the plugin author – maybe that will help him find the time to update this great plugin and make it future proof and work with CF7?

    Does this seem reasonable?

    Dan

    Simple fix, I do it all the time.

    Line 275 in cf7-campaignmonitor.php

    Old Code

    $url = wpcf7_admin_url( array( ‘page’ => ‘wpcf7’ ) );

    New Code

    $url = admin_url( array( ‘page’ => ‘wpcf7’ ) );

    Guys, can anyone post a full copy of the file somewhere? I’ve just spent 2 hours going round in circles editing the file with comments from above and elsewhere, trying to find the correct campaign monitor client/list ids, and I’ve still not got it working.

    If someone has a copy of the plugin working perfectly with the latest contact form 7 and wp4.0.1, could you please post the contents of cf7-campaignmonitor.php on codepad.org or equivalent?

    Thanks in advance…

    Hi all,

    I found a solution that works for me and does not rely on a special Campaign Monitor plugin. See how I did it here on my site:

    https://www.market2all.com/contact/

    I simply added the code that Campaign Monitor provides from within your account to add a SUBSCRIBE button into the Contact Form 7 form.

    Hope this helps. ??

    Thanks for that, it might be a good workaround if no-one has the core plugin working.
    Cheers

    Here’s the version that works for me:

    https://gist.github.com/davejamesmiller/9597400181d6a62ea603

    Thanks Dave, that’s really helpful. Your version is identical to mine as it happens – using fmzac’s updated snippet above, but it’s not working for me.

    Just to confirm – is your WP and CF7 up-to-date? If so, perhaps my key/client/list details are incorrect.

    Thanks for posting, it’ll help me pin down the issue.

    No problem. Yes they are up to date – WordPress 4.0.1 and CF7 4.0.2.

    Thanks again, but unfortunately they’re still not coming through.

    I’ve picked out what I believe to be the correct api key, client id and list id, based on guidance here: https://www.campaignmonitor.com/api/getting-started/#authenticating_with_an_api_key

    I’m using the client id, and the client api key, I’ve even tried what looks like an overall api key in account settings of CM, but they’re just not dropping in there whichever one I use.

    I’ve tried switching off contact form 7 db, just in case of a conflict. It’s not happening.

    I think I might have to go with Paul’s compromise above. Thanks for helping out though.

    Hi
    I have tried a new plugin at it seems to work:
    https://www.ads-software.com/plugins/contact-form-7-campaign-monitor-extension/
    it just doesn’t have the checkbox functionality, I guess the developer will add it soon.

    Dan

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘Contact Form 7 Campaign Monitor Addon Broken’ is closed to new replies.