fmzac
Forum Replies Created
-
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.phpfunction 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 )); } } } }Forum: Plugins
In reply to: [Contact Form 7 - Campaign Monitor Addon] WordPress 4.0 compatibility issuesThis is not WP issue. this is due to contact form 7 changes.
In file cf7-campaignmonitor.php on line approx:161 replace whole function
function wpcf7_cm_subscribe($obj)with this codefunction 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 )); } } } }basically these are the changes you need to take care if you are using any custom code related to contact form 7
/* Don't do this, since id property is no longer accessible. */ $id = $contact_form->id; // Wrong. /* Use id() method instead. */ $id = $contact_form->id(); /* Properties form, mail, mail_2, messages, additional_settings are inaccessible as well. */ $form = $contact_form->form; // Wrong. /* So, use prop() method to access them. */ $form = $contact_form->prop( 'form' ); /* To set the properties, use set_properties() method, like this: */ $mail = $contact_form->prop( 'mail' ); $mail['subject'] = "Well, hello, Dolly"; $contact_form->set_properties( array( 'mail' => $mail ) ); /* WPCF7_ContactForm object no longer has a posted_data property. */ $posted_data = $contact_form->posted_data; // Wrong. /* Use WPCF7_Submission object's get_posted_data() method to get it. */ $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); }Forum: Plugins
In reply to: [Contact Form 7 - Campaign Monitor Addon] Plugins Menu – Plugins disappearThis is due to deprecated function wpcf7_admin_url used in plugin.
In file cf7-campaignmonitor.php on approx line:358
Replace
$url = wpcf7_admin_url( array( 'page' => 'wpcf7' ) );with
$url = admin_url( array( 'page' => 'wpcf7' ) );i resolved this issue by modifying plugin.
on plugin installed location, edit file cf7-campaignmonitor.phpon approx line 40 replace this
add_action( ‘wpcf7_admin_before_subsubsub’, ‘add_cm_meta’ );with
add_action( ‘wpcf7_add_meta_boxes’, ‘add_cm_meta’ );Hope this will solve issue.
i resolved this issue by modifying plugin.
on plugin installed location, edit file cf7-campaignmonitor.phpon approx line 40 replace this
add_action( ‘wpcf7_admin_before_subsubsub’, ‘add_cm_meta’ );with
add_action( ‘wpcf7_add_meta_boxes’, ‘add_cm_meta’ );Hope this wil solve issue.
Forum: Reviews
In reply to: [Auto Tag Generator] Only uses words in post titleThis is what plugin description said i.e. “create tags from post TITLE”. Plugin do what it says.