我试图在function.php中插入自定义函数,以便更简单地复制如何编写插件,填写并发送表单的数据。服务器发给我一个错误:
Parse error: syntax error, unexpected '$formDB' (T_VARIABLE) in C:\AppServ\www\ITI\SITO\wp-content\plugins\contact-form-7\includes\functions.php on line 375
这是我的代码:
remove_all_filters ('wpcf7_before_send_mail');
add_action( 'wpcf7_before_send_mail', 'contactform7_before_send_mail' );
function contactform7_before_send_mail( $form_to_DB ) {
global $wpdb;
$submission = WPCF7_Submission::get_instance();
if ( $submission )
$formDB = $form_to_DB->get_posted_data();
$datains = now();
$username = $formDB['your-name'] $formDB['your-surname'];
$email = $formDB['your-email'];
$tel = $formDB['your-tel'];
$orario = $formDB['orario'];
$CentriITI = $formDB['CentriITI'];
$citta = $formDB['citta'];
$fasciadieta = $formDB['fasciadieta'];
$checkbox-info-sedi = $formDB['checkbox-info-sedi'];
$checkbox-checkup = $formDB['checkbox-checkup'];
$object = $formDB['your-object'];
$checkbox-trapianto = $formDB['checkbox-trapianto'];
$textarea-testo = $formDB['textarea-testo'];
$wpdb->insert( 'wp_form', array( 'datains' =>; $datains_form ), array( 'username_form' =>; $username ), array( 'email_form' =>; $email ) ,array( 'tel_form' =>; $tel ), array( 'orario_form' =>; $orario ), array( 'centro_form' =>; $centro ), array( 'citta_form' =>; $citta ), array( 'fasciaeta_form' =>; $fasciaeta ), array( 'object_form' =>; $object ), array( 'trapianto_form' =>; $checkbox-trapianto ) );
}
感谢您的回答