Support » Plugin: Contact Form DB » Save data from multiple forms to the same "table" – feature request

  • Resolved Mad Max


    Hi Michael,
    I’ve read in the forum about the request to save data from multiple forms to the same “table (i.e, with the same form name).
    I’m developing a 6 langs site for a hotel and I have to duplicate the reservation form 6 time, one for each language, but I’d like to see the posted data, all together, in one place in the backend.

    So I’ve made some little changes in your plugin, in CF7DBPlugin.php, function saveFormData($cf7).
    In short, I’ve added the form title among the data passed to the ‘cfdb_form_data‘ filter, so I can use this filter to modify the form title just before data are written to the db.

    Do you think you can add this patch to a future release of your great plugin? I think it could be useful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve tested it a little bit and I think it really usefull. Here is an example on how you could use this feature:

    //CF7 Forms - data convergence
    //data from 'key' will be saved with 'value' form name
    //TO DO: add this in the theme options panel or somewhere
    //else in the backend
    $my_form_data_aliases = array (
    	'Reservations (IT)' => 'Reservations',
    	'Reservations (EN)' => 'Reservations',
    	'Reservations (DE)' => 'Reservations',
    	'Reservations (FR)' => 'Reservations',
    	'Reservations (ES)' => 'Reservations',
     * Save data posted from multiple forms
     * under the same form name in the db
     * using a filter of cfdb plugin
    //Save several forms data to same "virtual table" (i.e wit the same table name in the db)
    function form_data_convergence($cf7) {
      global $my_form_data_aliases;
    	if (key_exists($cf7->title, $my_form_data_aliases)){
    		//Optional: save the filled post name
      return $cf7; // be sure to return it
    if ( isset($my_form_data_aliases) && is_array($my_form_data_aliases) && count($my_form_data_aliases) ) add_filter('cfdb_form_data', 'form_data_convergence');

    Hi and thanks Michael for a great plugin!

    This feature is exactly what I need and would be really useful. Would organize submissions from multilingual forms nicely. The code above is exactly my use case also.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Save data from multiple forms to the same "table" – feature request’ is closed to new replies.