Contact Form 7 Tips ( Action and Filter Hooks )

Home Forums Contact Forms Contact Form 7 Tips ( Action and Filter Hooks )

  •  
    4
    Shares
  • 4
  •  
  •  
  •  
  •  
  •  
  •  

This topic contains 2 replies, has 1 voice, and was last updated by  admin 4 months ago.

  • Author
    Posts
  • #101

    admin
    Keymaster

    Contact Form 7

    Best tips for contact form 7. It will speed up your WordPress development. CF7 can manage multiple contact forms and customize based your needs.  CF7 Ajax-powered submitting is available. It is most used contact form in WordPress. Easy to use and highly customizable contact form.

     

    Contact Form 7

     

    Save submitted data to the database

    We can use a CFDB7 addon to save submissions to the database. It is the best plugin to save data to the database. No need to configure. Just upload to your WordPress wp-admin plugins and activate it. It is 100% free plugin. More add-ons are available.

    Download now: https://wordpress.org/plugins/contact-form-cfdb7/

    Get posted data before sending email

    We can use the hookwpcf7_before_send_mail.

    Disable mail function in CF7 forms:-

    Skip mail function using a filterwpcf7_skip_mail.

    Mail not sending

    You should check “from” field is your website email address. Commonly some server is disabling PHP mail function. So we can use SMTP mailer class. It will reduce spam problem also.

    Install SMTP plugin https://wordpress.org/plugins/wp-mail-smtp/ and configure with your email SMTP authentication.

    Redirect after submission

    Method 1
    We can use wpcf7mailsent DOM event. Copy and paste following code to footer.php in your theme or paste to js file and call that js. window.location.href will redirect to thankyou page.

    Method 2
    Add following code in CF7 additional settings configuration page.
    on_sent_ok: "document.location='/thank-you-page/';"

    CF7 javascript events

    How to use Contact Form 7 in my own HTML?

    HTML to CF7 converter is available. http://cf7.ciphercoin.com
    Just copy and paste your HTML code it will convert to CF7 code. Then you can use generated cf7 code for your contact form.

    Custom validation to check business email and phone number

    Add following code to your theme functions.php file.

    How to use conditional fields?

    We can use  Conditional Fields plugin. Implement conditional login by “Conditional fields Group” additional tag.

    Login and start discussion

    Please share this content on social media.

    • This topic was modified 4 months ago by  admin.
    • This topic was modified 4 months ago by  admin.
  • #133

    admin
    Keymaster

    Contact Form 7 Drag and Drop Files Upload

    Filedrop addon will help you to enable drag and drop files upload functionality. JavaScript will handle errors.

    Download URL: https://ciphercoin.com/downloads/filedrop-contact-form-7/

     

    Contact form 7 code generator

    Just go to https://cf7.ciphercoin.com
    and paste your html form code it will convert to cf7 shortcode.

    Contact form 7 checkbox value in email

    Add checkbox name shortcode to mail section message body.
    Example cf7 shortcode [checkbox checkbox-403] the n we want add [checkbox-403] in message body.

     

    Contact form 7 autoresponder hook

     

  • #167

    admin
    Keymaster

    Contact Form 7 – Add custom function on email send.

    We can add custom PHP function by action hooks wpcf7_before_send_mail and wpcf7_mail_sent

    Method 1: Action before send Mail:

     

    Method 2: Action after sent Mail:

    do_action( 'wpcf7_mail_sent', $contact_form );  defined in /includes/submission.php  file.

    Here $contact_form variable is WPCF7_ContactForm class object.

You must be logged in to reply to this topic.