confirm form in email
-
Hi! I’m using the 2.4 version.
I would like to implement the email that the user receives after the application with a confirmation form, where at the click of the submit button, the column of my db is updated. is all this possible? I tried to modify the “applicant_email_notification” function with the code I attach below but it doesn’t work. Thanks in advance!function applicant_email_notification($post_id, $post, $emails){ if(empty($emails)) return true; global $wpdb; $mysql = "INSERT INTO candidate (nome_Candidato, cognome_Candidato, email_Candidato, cv_Candidato, telefono_Candidato, posizione_Candidato) SELECT MAX(CASE when meta_key = '_aol_app_name' THEN meta_value else ' ' END) AS '_aol_app_name', MAX(CASE when meta_key = '_aol_app_lastname' THEN meta_value else ' ' END) AS '_aol_app_lastname', MAX(CASE when meta_key = '_aol_app_email' THEN meta_value else ' ' END) AS '_aol_app_email', MAX(CASE when meta_key = '_aol_app_curriculum' THEN meta_value else ' ' END) AS '_aol_app_curriculum', MAX(CASE when meta_key = '_aol_app_phone' THEN meta_value else ' ' END) AS '_aol_app_phone', (SELECT post_title FROM wp_posts WHERE wp_posts.id LIKE (SELECT post_id FROM wp_postmeta WHERE(meta_key LIKE '_aol_app_name') OR (meta_key LIKE '_aol_app_lastname') OR (meta_key LIKE '_aol_app_email') OR (meta_key LIKE '_aol_app_curriculum') OR (meta_key LIKE '_aol_app_phone') GROUP BY post_id ORDER BY created_at DESC LIMIT 1 )) FROM wp_postmeta WHERE(meta_key LIKE '_aol_app_name') OR (meta_key LIKE '_aol_app_lastname') OR (meta_key LIKE '_aol_app_email') OR (meta_key LIKE '_aol_app_curriculum') OR (meta_key LIKE '_aol_app_phone') GROUP BY post_id ORDER BY created_at DESC LIMIT 1"; $wpdb->get_results($mysql); $subject = get_option('aol_success_mail_subject', 'Thank you for the application'); $post = (object)$post; // Get the site domain and get rid of www. $sitename = strtolower( $_SERVER['SERVER_NAME'] ); if ( substr( $sitename, 0, 4 ) == 'www.' ) { $sitename = substr( $sitename, 4 ); } $from_email = 'do-not-reply@' . $sitename; aol_from_mail_header(); $myConfirmLink ='<br>'.'<form action="class-applyonline.php" method="post"> <label>Click here to confirm your application!</label> <input type="submit" value="Confirm" name="confirm" /> </form>' ; function myCondition(){ if($_POST['confirm']){ global $wpdb; $applicant = "SELECT MAX(CASE when meta_key = '_aol_app_email' THEN meta_value else ' ' END) AS '_aol_app_email' FROM wp_postmeta WHERE(meta_key LIKE '_aol_app_email') GROUP BY post_id ORDER BY created_at DESC LIMIT 1 "; $applicantEmail = $wpdb->get_results($applicant); $mySqlid = "SELECT id FROM candidate WHERE email_Candidato LIKE $applicantEmail ORDER BY created_at "; $applicantId = $wpdb->get_results($mySqlid); $myConfirmQuery = "UPDATE candidate SET check_candidato = 1 WHERE (email_Candidato LIKE $applicant) AND (candidate.id LIKE $applicantId)"; $wpdb->get_results($myConfirmQuery); }else{ echo 'error'; }}; $headers = array('Content-Type: text/html', "From: ". wp_specialchars_decode(get_bloginfo('name'))." <$from_email>"); $attachments = array(); //@todo need a filter hook to modify content of this email message and to add a from field in the message. $message="Hi there,\n\n" ."Thank you for showing your interest in the ad: [title]. Your application with id [id] has been received. We will review your application and contact you if required.\n\n" .sprintf(__('Team %s'), get_bloginfo('name'))."\n" .site_url()."\n" ."Please do not reply to this system generated message.\n\n"; $message = str_replace(array('[title]', '[id]'), array($post->post_title, $post->ID), get_option('aol_success_mail_message', $message)); $aol_email = apply_filters( 'aol_applicant_mail_notification', array('to' => $emails, 'subject' => $subject, 'message' => nl2br($message.$myConfirmLink), 'headers' => $headers, 'attachments' => $attachments), $post_id, $post, $uploads ); do_action('aol_email_before', array('to' => $emails, 'subject' => $subject, 'message' => nl2br($message), 'headers' => $headers, 'attachments' => $attachments), $post_id, $post, $uploads); add_filter( 'wp_mail_content_type', 'aol_email_content_type' ); wp_mail( $aol_email['to'], $aol_email['subject'], $aol_email['message'], $aol_email['headers'], $aol_email['attachments']); remove_filter( 'wp_mail_content_type', 'aol_email_content_type' ); do_action('aol_email_after', $emails, $subject, nl2br($message), $headers, $attachments);
return true;
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘confirm form in email’ is closed to new replies.