mstaudt
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Contact Form 7] Critical issue with 5.2Hi,
same (huge) problem for me too…have so many customers with functions appending on the
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();Please Takayuki Miyoshi provide at least an alternative solution.
Forum: Plugins
In reply to: [Contact Form 7] Custom function $posted_data not working after 5.2Hi,
I have exactly the same problem.
Since cf7 v5.2.2 my own function to attach an xml-file created from form data doesn’t work anymore. My function is attached to the end of the file “settings.php” in the root of the cf7 plugin directory.
The form will not sent and the timer runs endlessly.
The form works when I comment out:
$posted_data = $submission->get_posted_data();but then of course an xml without values will be attached.
My code excerpt:<?php // define the callback function function my_get_form_values($contact_form) { // get info about the form and current submission instance $formTitle = $contact_form->title(); // define which form you're looking for (if you have multiple) if (($formTitle == "Objekt-Kauf-Suche") { $submission = WPCF7_Submission::get_instance(); // get the actual data! if($submission) { $posted_data = $submission->get_posted_data(); } // Get a serial number to distinguish report from others $serialNr = md5(uniqid(rand(), true)); // Create xml doc spec $xmlDoc = new DOMDocument('1.0', 'ISO-8859-15'); $xmlDoc->formatOutput = true; // Build XML file with root element $xmlRoot = $xmlDoc->createElement('openimmo_feedback'); $xmlDoc->appendChild($xmlRoot); //node 'Interessent' $xml_Interessent = $xmlDoc->createElement('interessent'); //nodes for 'Interessent' //first name $xml_vorname = $xmlDoc->createElement('vorname', $posted_data['vorname']); $xml_Interessent->appendChild($xml_vorname); //last name $xml_nachname = $xmlDoc->createElement('nachname', $posted_data['nachname']); $xml_Interessent->appendChild($xml_nachname); //append interessent to objekt $xml_Objekt->appendChild($xml_Interessent); //append all to root $xmlRoot->appendChild($xml_Objekt); //generate the path/filemame $file = "wp-content/plugins/contact-form-7/Kraus-Immo-".$formTitle."_".$serialNr.".xml"; //generate the path/filemame for the temp. copy $file_copy = "wp-content/plugins/contact-form-7/Kraus-Immo-".$formTitle."_".$serialNr."_attach.xml"; // save it as a file for further processing $content = chunk_split(base64_encode($xmlDoc->saveXML())); $xmlDoc->save($file); /* make temp. copy */ copy($file, $file_copy ); /* attach temp. copy */ $submission->add_uploaded_file( 'xml', $file_copy); } } // add the action add_action('wpcf7_before_send_mail', 'my_get_form_values', 10, 1);Any help is very appreciatetd. Thanks in andvance!
Viewing 2 replies - 1 through 2 (of 2 total)