Hot answers tagged

14

There's two ways to do what you're wanting. First way is to add this code to functions.php of the Contact Form 7 plugin: add_filter( 'wpcf7_form_elements', 'mycustom_wpcf7_form_elements' ); function mycustom_wpcf7_form_elements( $form ) { $form = do_shortcode( $form ); return $form; } That allows you to drop shortcodes directly into CF7. Second is to ...


6

It looks like this is supported by Contact Form 7 natively, it's just not very obvious on how to make it happen. Here's a documentation page explaining the functionality: http://contactform7.com/selectable-recipient-with-pipes/ Basically all you have to do is put the values like so: Visible Value|actual-form-value What comes before the pipe "|" character ...


6

Take a look at the wpcf7_before_send_mail hook CF7 provides. add_action("wpcf7_before_send_mail", "wpcf7_do_something_else_with_the_data"); function wpcf7_do_something_else_with_the_data(&$wpcf7_data) { // Everything you should need is in this variable var_dump($wpcf7_data); // I can skip sending the mail if I want to... ...


5

WP Ajax runs both public as well as closed calls via admin.php. This means that you don't have access to the whole wp environment, such as do_shortcode(), which is inside /wp-includes/shortcodes.php. This still can get worked around (and as well for oEmbed). See the following example that you could use in your AJAX callback to enable both oEmbed handlers ...


5

You haven't given enough information, so it might have something to do with javascript conflicts, files not loading, server SMTP, etc. Best thing to do is work through the Contact Form 7 issues FAQ at contactform7.com/faq/


4

I'd say this question is mostly off-topic since it's not WordPress-specific. Mostly, because the majority of PHP solutions out there use sessions, which will not work out-of-the-box in WordPress. Google search actually handles this question quite well. Have a look at this discussion for nice techniques. Finally, Contact Form 7 has Captcha built-in.


4

Well without more code it's hard to tell but one thing is you are wrapping a shortcode with php tags. My guess is you have error logs turned off or you'd see Santax error unexpected '[' on line XXX If you are using the post/page editor you want to use[contact-form-7 id="181" title="Contact form 1"] (see no php tags) If you really want to use php tags (or ...


4

simply add you JavaScript function to your page then find the Additional Settings field at the bottom of the contact form management page and use the on_sent_ok JavaScript action hook like so: on_sent_ok: "MY_JavaScript_function_Name();"


3

Check your CPANEL to make sure mail isnt going to a local mailbox. despite any MX settings, if you have a remote mailbox somewhere else, mail sent from wordpress will first go to any local mailbox. you must disable this in CPANEL/mx entry maintenance. this solved my issue.


3

You're doing it wrong. get_currentuserinfo() returns the data into some preset global variables. Try this: function outta_here() { global $user_ID; get_currentuserinfo(); wp_delete_user($user_ID); } add_action( 'wpcf7_before_send_mail', 'outta_here' ); You can read more about get_currentuserinfo() on WP Codex.


3

Use Pipes. See the FAQ: http://contactform7.com/selectable-recipient-with-pipes/ I.e.: [select your-recipient "CEO|ceo@example.com" "Sales|sales@example.com" "Support|support@example.com"]


3

As per my comments, it seems you are trying to attach images to emails rather than 'show' them. Since you have [file* image filetypes:jpg|png|gif] what you need to do is put [image] in the 'File Attachments' box in the Contact Form 7 settings. This is from the Contact Form 7 File Uploading and Attachment doc.


3

Got it, needed to add this to the additional settings option: on_sent_ok: "location = 'http://www.url.com';"


3

In Additional Settings, use on_sent_ok: "location = 'http://example.com/';" to redirect to another page, but as said above, it's not that secure. You can hide the page via robots.txt.


3

You can use my plugin called MailChimp for WordPress to do this. When installed, you can select one or multiple lists in the plugin settings and use the following shortcode inside your Contact Form 7 templates. [mc4wp_checkbox "Your label text"] It will render a checkbox and when checked, subscribe the given email address to the MailChimp lists you ...


3

Could somebody explain why it's advised never to load wp-admin/admin.php in your plugin and how it could cause issues? Because it is loading WordPress out of context-- well, parts of WordPress. And that can cause unexpected effects such as functions not being loaded or functions being loaded twice (which will cause fatal errors). You will have trouble ...


3

Try this instead. There was some internal restructuring in CF7 3.9. add_action('wpcf7_before_send_mail','send_pdf'); function send_pdf( $cf7 ) { $id = $cf7->id(); if ($id==741){ $submission = WPCF7_Submission::get_instance(); $submission->add_uploaded_file('pdf', get_template_directory().'/test.pdf'); } } This should ...


3

to answer the question: this is not possible. AFAIK, (HTMLwise) there's no way to add a placeholder to select tags. A lot of devs I know however tend to use disabled selected combination for the option... <select> <option value="" disabled selected>Select your option</option> <option ...


3

Alternatively you could use JavaScript or jQuery. Put each "page" of the form in a its own section / div. Hide all of the divs but the first, and have a button which will hide the current section/div and show the next. On the final div you have the submit button. This will help you out if you choose to go down this route: ...


2

In order to split a long list of form into multiple steps using Contact Form 7. There is a free plugin availble, Contact Form 7 Multi Steps Module Install this plugin and follow the instructions as mentioned on the plugin's description page. Hope this helps!


2

-- Append parent_ to all your top level options' values like: parent_Course A, parent_Course B -- Also add extra options with the value as "endparent" something like below structure parent_Course A: course 1 course 2 course 3 course 4 endparent parent_Course B: course 1 course 2 course 3 endparent Code: // contact us form - change out ...


2

Contrary to what the accepted answer suggests, it actually is possible and built into Contact Form 7. Here's the actual list of options [select] holds. Pretty much you would define the first option to be the placeholder using first_as_label: [select* Test first_as_label "Placeholder" "Option 1" "Option 2"] While it won't traditionally look like a ...


2

Probably the folder is there already. With your ftp client, browse to wp-content > plugins. Do you see it there? then delete it and try again. You can also download the plugin folder from the Wordpress plugin page to your computer and ftp it to the wp-content/plugins folder. This way it won't give any problems because, if you already have the folder there, ...


2

Just write the code into additional setting of contact from 7 as bellow : on_sent_ok: "var Iso = $("input[name=radio-565]:checked").val() ; if(Iso == 'value1' ){ location = 'www.example.com'; } if(Iso == 'value2' ){ location = 'www.example2.com'; }" #### input[name=radio-565] = radio button name value1 = radio button 1st value value2 = radio button 2nd ...


2

Have you tried the options suggested in this WordPress Support thread? They range from copying the generated code in a Text Widget to parsing the shortcode yourself in your template (<?php echo do_shortcode('[contact-form 1 "Contact form 1"]'); ?>).


2

That action means "post the form back to the website root". Your website root is the very 'top level' of your domain, for example http://www.example.com/. The hash indicates the point in the document to jump to - in this case, I'm betting the ID of the form is wpcf7-f1-t1-o1? You shouldn't need to alter this. Even though the form is on a page outside of ...


2

It seems Contact Form 7 allows you to specify the recipient via a select dropdown. This means that the recipient e-mail address is stored in the form and sent to the server, which then just reads it. Unless the server then verifies the recipient address was one of the options you specified, this can be a "security hole" to send spam to other e-mail ...


2

First change the `on_sent_ok' to: on_sent_ok: 'my_redirect();' then create that my_redirect() function in the page that displays the form: <script> function my_redirect() { var price = document.getElementById('PRICE_FIELD').value; var url = ...


2

The following link details a few of the fixes that have worked for some users. http://itsjg.com/blog/2011/03/failed-to-send-your-message-please-try-later-or-contact-administrator-by-other-way/ These fixes include: change the wordpress contact form area from section ([your-name] <[your-email]>) to info@yourserver.com. add all fields inside ...


2

In your jQuery AJAX call you should add some javascript to redirect the page: window.location.replace("http://wordpress.stackexchange.com");



Only top voted, non community-wiki answers of a minimum length are eligible