Source code for https://formidable-masterminds.com/taming-e2pdf-saves/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('frm_after_create_entry', 'generate_form_e2pdf_for_summary', 30, 2); | |
add_action('frm_after_update_entry', 'generate_form_e2pdf_for_summary', 10, 2); | |
function generate_form_e2pdf_for_summary($entry_id, $form_id) { | |
global $wpdb; | |
$formIdList = array(1,2,3); // use your own list of form ids for which you use e2pdf | |
if (in_array($form_id, $formIdList)) { | |
// find the matching e2pdf form template | |
$sql = "SELECT ID FROM {$wpdb->prefix}e2pdf_templates WHERE item = $form_id"; | |
$templateId = $wpdb->get_var($sql); | |
$fileName = “”; // set your file name | |
$dirName = “”; // set your directory name, e.g., wp-content/uploads/xxx | |
echo do_shortcode('[e2pdf-save id="' . $templateId . '" name="' . $fileName . '" dataset="' . $entry_id . '" dir="' . $dirName . '" create_dir="true" overwrite="true" apply="true" filter="true"]'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment