The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Contact Form 7
Add solution for 3rd party integration and managing errors (4 posts)

  1. klode
    Posted 3 years ago #

    I have reverse engineered a piece of your plugin.

    In the file includes/classes.php, in the row 480, where there's a control in skip_mail parameter, I have added this code:

    global $wpcf7;
    if ( $this->skip_mail )
    		if($wpcf7->result["valid"] == 1) return true;
    		else return false;
    		return true;

    In this mode, when there is a control with 3rd party integration, it's possible to set:

    global $wpcf7;
    $wpcf7->result["valid"] = 0; //in case of error
    $cf7->skip_mail = true;

    in order to declare the variable "mail_sent" on ajax response to false. Again, with this code:

    $cf7->messages["mail_sent_ng"] = "Some error occured!";

    it's possible to customize the message on return from Server.

    That's it!

    I hope this my little editing can help someone!!!


  2. biswajeet
    Posted 3 years ago #

    Thanks. btw, messages are already customizable...

  3. rospo85
    Posted 3 years ago #

    biswajeet, what can I do to customize my message?
    I need to do it programmatically, not by the CF7 setting panel!
    Do you have an option different by the one of klode?
    klode, your solution work well for me, but i don't like to hack the plugin code if i can...

  4. zaus
    Posted 3 years ago #

    I'd suggest looking at how my plugin http://wordpress.org/extend/plugins/forms-3rdparty-integration/ hooks to the wpcf7_before_send_mail action to alter the $form->messages['mail_sent_ok'] (screen message) or $form->mail['body'] (email). Main point is never alter plugin code if they provide hooks, and CF7 is good about providing a lot of hooks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic