Contact Form 7

Contact form 7 multiple file upload using single file upload field
https://wordpress.org/plugins/multifile-upload-field-for-contact-form-7/

Contact form 7 set post title in textbox
Install “Contact Form 7 Dynamic Text Extension” plugin.
Then add form tag like this:

[dynamictext* dynamicname readonly "CF7_get_post_var key='title'"]

Contact form dynamic text fields
https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/

Pop up contact form 7
The easy way is show the contact form in a popup window using the plugin “Easy fancy box“.
Once you created the contact form it generate a short code something like this

[contact-form-7 id="150" title="Contact form 1"]

Now just copy the below code and paste it where you want the popup to be

<a href=“#form_pop” class=“fancybox” id=‘fancybox’ >Contact Us</a>
<div style=“display:none” class=“fancybox-hidden”>
    <div id=“form_pop”>
        [contactform7 id=“150” title=“Contact form 1”]
    </div>
</div>

contact form 7 custom mail tag
Eg Code:

add_filter( 'wpcf7_special_mail_tags', 'your_special_mail_tag', 10, 3 );
function your_special_mail_tag( $output, $name, $html ) {
if ( 'yourtagname' == $name ) {
   $output = date('d/m/Y' );
}
return $output;
}

Then add [yourtagname] in your mail template.

Custom validation
Eg code:

add_filter('wpcf7_validate_text','custom_text_validation_filter', 10, 2);
add_filter('wpcf7_validate_text*', 'custom_text_validation_filter', 10, 2);
function custom_text_validation_filter($result, $tag) {
   $type = $tag['type'];
   $name = $tag['name'];
   $value = trim($_POST[$name]);
   if($name == 'subject') {
      if(!empty($value)){
         if(strlen($value)>50){
            $result->invalidate( $tag, "The field is too long.Please keep subject under 50 characters." );
         } else if (preg_match('/[\'^£$%*()}{@#~><>|=_+¬]/', $value)){
            $result->invalidate( $tag, "Invalid characters." );
         }
      }
   }
}

Contact form 7 as registration form
Useful Links:
http://www.mootpoint.org/blog/wordpress-contact-form-7-user-registration/
https://wordpress.org/plugins/frontend-registration-contact-form-7/

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s