contact-form-7

Saving contact form 7 data into custom db and not wordpress db

半腔热情 提交于 2019-12-01 13:10:57
问题 I am using contact form 7 for creating my form and I have a custom db hosted in the same server that should contain the related data. I want to store the data from the contact from7 into my custom db and not a wordpress db. I am doing the below in functions.php now, add_action('wpcf7_before_send_mail', 'save_form'); function save_form($wpcf7) { /* For connecting to database */ $dbuser = "user"; $dbpass = "pass"; $dbhost = "localhost"; $dbname = "cistom_db"; // Connect to server and select

Target wpcf7mailsent of a specific contact 7 form

戏子无情 提交于 2019-12-01 11:27:39
Im using Wordpress and Contact Form 7. I would like the user to be able to fill out a form, and after successful submit a file will download. Im using javascript to target the wpcf7mailsent event, which then directs to the file. Im forcing the pdf to download in the .htaccess file. This all works fine, however I have multiple forms on the page, and only want this logic to apply to one specific contact 7 form. How can I get that to work. Here is the output for the HTML and JS for the form I wish this to happen on: <section id="downloads"><span class="text">Download Brochure</span> <div class=

Conditional auto responder is Contact Form 7

自闭症网瘾萝莉.ら 提交于 2019-12-01 09:42:35
问题 I have two versions of an auto responder that I would like to send out based on what the user selected from a dropdown field. So if the user selected California from the dropdown they would get autoresponder 1 and if the user selected Texas they would get auto responder 2. Is there a way to do this? 回答1: Where exactly should be this code added? hook in to wpcf7_mail_sent - this will happen after form is submitted add_action( 'wpcf7_mail_sent', 'contact_form_autoresponders' ); our

Target wpcf7mailsent of a specific contact 7 form

时光毁灭记忆、已成空白 提交于 2019-12-01 07:06:27
问题 Im using Wordpress and Contact Form 7. I would like the user to be able to fill out a form, and after successful submit a file will download. Im using javascript to target the wpcf7mailsent event, which then directs to the file. Im forcing the pdf to download in the .htaccess file. This all works fine, however I have multiple forms on the page, and only want this logic to apply to one specific contact 7 form. How can I get that to work. Here is the output for the HTML and JS for the form I

Contact Form 7: Set default date to today

烂漫一生 提交于 2019-11-30 22:30:44
How do I set the default date to today, using Contact Form 7? The minimum date can be set easily with min:today . When you click on a datepicker you can choose dates from today. But the default date (before picking) is not today's date. The date is displayed like 2016/mm/dd or whatever date format. Yes, I added a script <script> jQuery(function ($) { var now = new Date(); var day = ("0" + now.getDate()).slice(-2); var month = ("0" + (now.getMonth() + 1)).slice(-2); var today = now.getFullYear()+"-"+(month)+"-"+(day); $('#datePicker').val(today); $("#datePicker").attr("min", today); }); <

Contact Form 7: use hook created using wpcf7_before_send_mail for only one contact form by id

你离开我真会死。 提交于 2019-11-30 09:12:10
I am working on a site with several forms created using Contact Form 7. For one of these forms, I am passing variables that I collected using a hidden input field in the form. I am passing these variables into the email using the wpcf7_before_send_mail hook, but these values are passing into every email (I added dynamic variables as well as static text) Here's the code: add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' ); function wpcf7_add_text_to_mail_body($contact_form){ $values_list = $_POST['valsitems']; $values_str = implode(", ", $values_list); // get mail property

Wordpress Contact form 7 custom shortcodes

爱⌒轻易说出口 提交于 2019-11-30 09:04:22
Contact form 7 has some shortcodes, like [_date] to get todays date. But I want to display the date one week from now. So I need to create a custom shortcode to Contact form 7 that takes say [next_week] and in the recived email the correct date is displayed. Where and how do I create custom shortcodes to Contact form 7? Add the following to your functions.php wpcf7_add_shortcode('custom_date', 'wpcf7_custom_date_shortcode_handler', true); function wpcf7_custom_date_shortcode_handler($tag) { if (!is_array($tag)) return ''; $name = $tag['name']; if (empty($name)) return ''; $next_week = date('Y

How to hook into Contact Form 7 Before Send

纵饮孤独 提交于 2019-11-30 08:51:40
I have a plugin I am writing that I want to interact with Contact Form 7. In my plugin I added the following action add_action add_action("wpcf7_before_send_mail", "wpcf7_do_something_else"); function wpcf7_do_something_else(&$wpcf7_data) { // Here is the variable where the data are stored! var_dump($wpcf7_data); // If you want to skip mailing the data, you can do it... $wpcf7_data->skip_mail = true; } I submitted the contact form but the add_action I had did nothing. I'm unsure how to make my plugin intercept or do something when Contact Form 7 does something. Any, help on how to do this? I

How to hook into Contact Form 7 Before Send

折月煮酒 提交于 2019-11-29 12:34:20
问题 I have a plugin I am writing that I want to interact with Contact Form 7. In my plugin I added the following action add_action add_action("wpcf7_before_send_mail", "wpcf7_do_something_else"); function wpcf7_do_something_else(&$wpcf7_data) { // Here is the variable where the data are stored! var_dump($wpcf7_data); // If you want to skip mailing the data, you can do it... $wpcf7_data->skip_mail = true; } I submitted the contact form but the add_action I had did nothing. I'm unsure how to make

Wordpress Contact form 7 custom shortcodes

帅比萌擦擦* 提交于 2019-11-29 12:25:54
问题 Contact form 7 has some shortcodes, like [_date] to get todays date. But I want to display the date one week from now. So I need to create a custom shortcode to Contact form 7 that takes say [next_week] and in the recived email the correct date is displayed. Where and how do I create custom shortcodes to Contact form 7? 回答1: Add the following to your functions.php wpcf7_add_shortcode('custom_date', 'wpcf7_custom_date_shortcode_handler', true); function wpcf7_custom_date_shortcode_handler($tag