• 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(isset($wpcf7->result["valid"]))
    		if($wpcf7->result["valid"] == 1) return true;
    		else return false;
    	else
    		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!!!

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks. btw, messages are already customizable…

    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…

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add solution for 3rd party integration and managing errors’ is closed to new replies.