Goodmorning, I used this hook with CF7
'wpcf7_before_send_mail', 'log_cf7'
and when the form are submited “wpcf7-spinner” doesn’t stop to turning and the message of from submission ok doesn’t show (wpcf7-response-output)
I tried to disable every other plug in with out good news.
I tried to disable parts of php text but this isn’t the right way
Only if I exclude:
'wpcf7_before_send_mail', 'log_cf7
spinner disappear and the response output come showed.
Some one can help me?
Follow the code that I used:
<?php
add_action('wpcf7_before_send_mail', 'log_cf7');
function log_cf7($WPCF7_ContactForm) {
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$upload_dir = wp_upload_dir();
echo $upload_dir['basedir'] . '/wpcf7_uploads';
$text .= "CSTPRODREG";
$text .= "|||";
$text .= $data['text-638'];
$text .= "|||||||||||||";
$text .= $data['checkbox-613'];
$text .= "||";
$text .= $data['your-name'];
$text .= "|";
$text .= $data['text-628'];
$text .= "||||||";
$text .= $data['tel-709'];
$text .= "|||";
$text .= $data['your-email'];
$text .= "||||||";
$text .= $data['menu-470'][0];
$text .= "|";
$text .= $data['menu-749'][0];
$text .= $data['menu-750'][0];
$text .= $data['menu-751'][0];
$text .= $data['menu-752'][0];
$text .= $data['menu-753'][0];
$text .= "||";
$text .= $data['number-540'];
$text .= $data['number-550'];
$text .= $data['number-563'];
$text .= $data['number-576'];
$text .= $data['number-580'];
$text .= $data['text-576'];
$text .= $data['number-581'];
$text .= $data['number-581'];
$text .= $data['number-585'];
$text .= "||";
$text .= $formatted_date = str_replace('-', '', $data['date-855']);
$text .= "|||";
$text .= 'www.mysite/wp-content/uploads/cfdb7_uploads/' . $_FILES['file-799']['name'];
foreach ($data as $key => $value) {
}
function getUniqueFilename() {
return date("YmdHis" , strtotime('+2 hours')) . '.prr';
}
$myfile = fopen($_SERVER['DOCUMENT_ROOT'] . '/' . getUniqueFilename(), 'wb');
fwrite($myfile, $text);
$ftp_server="ftp.mysite";
$ftp_username="xxx";
$ftp_userpass="xxx";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
if(ftp_put($ftp_conn,"newdata.prr",$_SERVER['DOCUMENT_ROOT'] . "/tempFile.prr",FTP_ASCII))
{
print("yay");
}
else
{
print("f...");
}
ftp_close($ftp_conn);
fclose($myfile);
}
?>
?>