<?php

function save_application_form($cf7) {
    global $wpdb;
    
    if(isset($cf7->posted_data["tu-mensaje"])) {
        $table_name = $wpdb->prefix."ltw_testimonials";
        $results = $wpdb->insert(
                        $table_name, 
                        array('group_id' => 1,
                              'testimonial' => $cf7->posted_data["tu-mensaje"],
                              'client_name' => $cf7->posted_data["tu-nombre"],
                              'client_pic' => 'http://localhost/lqdvi/webcam/images/'.$cf7->posted_data["id"],
                              'client_website' => $cf7->posted_data["tu-email"],
                              'client_company' => '',
                              'show_in_widget' => 0,
                              'order' => 0));
        
        return $result;
    } else {
        return false;
    }
}


add_action( 'wpcf7_before_send_mail', 'save_application_form');
?>
