WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Hook for a specific form (2 posts)

  1. hareld
    Member
    Posted 1 year ago #

    Hi,

    I have 4 forms on my website which I need them to send data to a custom build CRM by a (given) PHP code. The data will be send on submit.

    3 questions:
    1. which hook should I use to able me to send data on/after submit.
    2. what php code should I use to specify what fields to send.
    3. how can I use a hook for each form (each form that sent to the CRM should have a different name).

    Thanks!

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

  2. hareld
    Member
    Posted 1 year ago #

    I found this thread here, so I might use this code?

    add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' );
    
    function your_wpcf7_mail_sent_function( $contact_form ) {
    	$title = $contact_form->title;
    	$posted_data = $contact_form->posted_data;
    
    	if ( 'Your Contact Form Title Here' == $title ) {
    
    		$phone = $posted_data['phone']; // if you have a field with name "phone"
    
    		require_once 'SMS.class.php';
    		$api = new LittleSMS('vasya', 'qwerty123', true);
    		$api->sendSMS($phone, 'Бугагашенька!', 'vasya');
    
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic