Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter Rumores

    (@rumores)

    Hi again,

    As Mailpoet field integration and subscribe process seems to be broken atm, here’s the code I use to keep this functionnality working on CF7 forms.

    First, insert this shortcode on the CF7 form :

    [checkbox your-subscription default:1 "Subscribe to our newsletter"]

    Then add the following code on “functions.php” (replace “your-email”, “your-firstname”, “your-lastname” and “your-subscription” with the field names used on the form) :

    function get_mailing_lists() {
    	$model = WYSIJA::get('list','model');
    	$lists = $model->get(array('name','list_id'), array('is_enabled'=>1));
    	$datas = array();
    	foreach($lists as $list) { $datas[] = $list['list_id']; }
    	return $datas;
    	}
    function add_subscriber_from_contact_form() {
    	$cf7 = WPCF7_Submission::get_instance()
    	if($cf7) { $form_data = $cf7->get_posted_data(); }
    	$user_data = array(
    		'email'     => $form_data['your-email'],
    		'firstname' => $form_data['your-firstname'],
    		'lastname'  => $form_data['your-lastname'],
    		);
    	$list_data = array(
    		'user'      => $user_data,
    		'user_list' => array('list_ids' => get_mailing_lists()),
    		);
    	if(!empty($form_data['your-subscription'])) {
    		$user_helper = &WYSIJA::get('user','helper');
    		$user_helper->addSubscriber($list_data);
    		}
    	}
    	add_action('wpcf7_mail_sent', 'add_subscriber_from_contact_form');

    Hope it helps!

    I’m having the same issue. Can someone help please?
    The above workaround is also not working for me (breaks to whole site – but not sure where the error is).

    Thanks in advance for any help provided!

    Having the same issue. Developers, when will you be coming out with an update to fix this?

    A fix would be really appreciated! Thanks!

    Hi! Same issue for me! Waiting for a fix!
    Thanks!

    ??

    The fix proposed by Rumores not working. If i install it all the website will break it,
    maybe there is a syntax error.

    Dear Developers Please fix this gorgeous integration ??

    Really thank you to everybody!
    Federico

    Same here… Waiting for a fix asap. Thanks.

    Same problem here, same symptoms.

    Same problem here. This report is over a month old, when will this bug be fixed?

    Hey,

    For those who tried to use Rumores’ and broke their site, all you need to do is add a semicolon ->;<- after this line
    $cf7 = WPCF7_Submission::get_instance()
    becomes
    $cf7 = WPCF7_Submission::get_instance();

    Unfortunately I can’t specify to which list I’d like people to subscribe to.

    I’ll try and work it out using Rumores’ code snippet as a base.

    Good luck everyone

    Developers PLEASE get a fix out for this asap!

    I thought I’d got it working by using Rumores code along with Depremo’s ammendment. However, it appears that a user gets subscribed whether the box is ticked or not?
    Is everyone else who’s tried the fix getting this?

    Regards P Walsh

    I know nothing about PHP but after some tinkering with Rumores code it appears (to my tiny mind) that the following code section isn’t working?

    if(!empty($form_data['your-subscription'])) {
    		$user_helper = &WYSIJA::get('user','helper');
    		$user_helper->addSubscriber($list_data);
    		}

    It seems that the “if” conditional is firing regardless of the checkbox state. If any PHP guru could help out with this it would be awesome! I think we’re close to a fix.

    Hey,

    Washi, my colleague fixed the issue just replace

    if(!empty($form_data['your-subscription'])) {
    		$user_helper = &WYSIJA::get('user','helper');
    		$user_helper->addSubscriber($list_data);
    		}

    with

    if( ! empty($form_data['your-subscription'][0]) ) {
    		$user_helper = &WYSIJA::get('user','helper');
    		$user_helper->addSubscriber($list_data);
    		}

    Wow! It works!!!

    Depromo and Colleague I am forever in your debt!

    Thank you SOOOOO much for the help.

    Regards Paul

    Also waiting……

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Incompatibility with CF7 version 4.2’ is closed to new replies.