Flamingo Address Book WordPress Plugin

Flamingo is a free WordPress plugin created to be a total CRM package. With this version, you can manage your contact list and messages submitted via contact form plugins. It has not yet matured, but we are enhancing it rapidly. I have recently used it in our website. It store complete information submitted by the visitor as well as additional information like ip address, browser, url etc. Important thing it also support Contact Form 7.

Run a function before sending email in contact form 7

Contact Form 7 is one of the most popular form management plugins available on WordPress repository. Which provide user friendly interface for managing form and email body. We can also manage addition settings like success or failure message form redirection etc in plugin settings.

We have on_sent_ok and wpcf7_before_send_mail which allow us to run our own custom commands before and after form submission. on_sent_ok is a JavaScript action hook. By using this hook, you can specify a JavaScript code that you wish to run after the form is successfully submitted. You will find the Additional Settings field at the bottom of the contact form page. Simply insert the following line into it

on_sent_ok: "location = 'http://example.com/';" 

I recently needed to create a function that needed to send sms to website owner for calling their executive to the visitor using Contact Form 7.

The code below creates a similar custom function before a Contact form 7 form is submitted. We need to add this code in theme’s functions.php file, adding the wpcf7_before_send_mail hook as an add_action call.

add_action('wpcf7_before_send_mail', 'my_custom_function');
function my_custom_function($cf7) {
    //Put PHP here

One thing to remember if you try and use echo to try and show any output, this will not be displayed because Contact Form 7 is designed to work using AJAX commands that execute PHP.

If you want to use form field data, we can grab this using regular $_POST variables as below:

add_action( 'wpcf7_before_send_mail', 'my_custom_function' );
function my_custom_function($cf7) {
   $output = "";
   $output .= "Name: " . $_POST['name'];
   $output .= "Email: " . $_POST['email'];
   $output .= "Message: " . $_POST['message'];
 file_put_contents("putoutput.txt", $output);

In this example, I have used file_put_contents php function which save form submitted data as a regular text in text file. The file is saved in the WordPress site root directory.

Add google reCaptacha to contact form 7

Hi friends, Google has an improved, user-friendly Captcha system. In Which it asked for checked a checkbox  for confirming “I’m not robot”. In WordPress, Contact Form 7 is the most popular plugin for creating contact form. Latest version of Contact Form 7 provide best way for antispam protection.

In this tutorial, I’m going show you how to integrate reCaptcha to Contact Form 7 in your WordPress Website.

Step 1. Install the Contact Form 7 plugin

  • Login to your WordPress site.
  • Go to Plugins > Add new and search for “Contact Form 7”.
  • Click “Install Now” and activate the plugin.

Step 2. Create reCaptcha public and secret keys


Step 3. Integrate reCaptcha with Contact Form 7

  • Go to the admin menu Contact > Integration.
  • Find reCAPTCHA panel and click Configure Keys.
  • Copy the site key and secret key into the fields and save them.

Step 4. Embed the reCaptcha shortcode into contact form

  • Go to Contact > Contact forms > Your form.
  • Paste below shortcode into form box to render the reCaptcha field.

End Result