• I’m sure I’m missing something basic, so I apologize if this is just me being dense.

    I have created a contact form, defining nicknames that I will need later. The data being submitted through this page needs to be exported into a text file with a specific format:
    USR1NAME=Person Name
    USR1EMAIL=myemail@sample.com
    USR1PHONE=1231231234

    And so on. I’m sure I could import the tab-delimited csv file into a spreadsheet, then manually export it into the format desired, but I’d really rather not add another step to this process.

    I was trying to modify the Form Summary page to display the data in this way, but even when I modify the template file, the changes don’t appear.

    So, my questions are:
    1) When I click on the Submission Data tab for the particular Form, and then click View for one row of results, what template is being used?
    2) Is there a way to export one file at a time, or to generate multiple export files from the results? I.e. can I export a single record from the Summary page?

    http://wordpress.org/extend/plugins/wordpress-form-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter NiviE

    (@nivie)

    To be complete, here is the code that I created in a copy of fm-summary.php:

    <?php while(fm_summary_have_items()): fm_summary_the_item(); ?>
    	<?php switch(fm_summary_the_type()){
    		case 'separator': ?><hr /><?php break;
    		default:
    		if(fm_summary_has_data()): ?>
    			<?php if(fm_summary_the_nickname() != "") {
    				$data = fm_summary_get_item_label(fm_summary_the_nickname())
    				$data = strtoupper($data);
    				echo $data . "\=" . fm_summary_the_value()."\n";
    			}
    			?>
    	<?php endif;
    		} // end switch ?>
    <?php endwhile; ?>

    And this is the template that I’ve chosen for email and summary in Advanced Settings.

    Plugin Author hoffcamp

    (@hoffcamp)

    The summary template is used on the front end, either as a form ‘acknowledgment message’, or when using the formdata shortcode. The e-mail template is used in the e-mails. Neither are used for the submission data tab.

    I would edit getcsv.php, remove lines 32 to 41 (as of 1.6.26), basically all the stuff that has to do with generating csv and outputing the csv file headers. Instead, replace it with:

    global $wpdb;
    $thedata = $wpdb-> get_results( $query ) ) ;

    Now $thedata will contain all of the submission data that would have otherwise been in a CSV format, now as a PHP array. From there you can echo / do whatever you want with it.

    Just make sure to keep your own copy of getcsv.php, since updating the plugin will obliterate your customization.

    Alternatively you could write a script to run on your local machine to convert a CSV file into the format you are looking for. PHP has good functions for reading and writing CSV data, and since you are comfortable with PHP that might be a good option. I don’t know what OS you are running but that might work better, especially for batch jobs.

    Thread Starter NiviE

    (@nivie)

    Thank you! That was exactly what I needed.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: WordPress Form Manager] Summary Page Not changing with new Template’ is closed to new replies.