From bd31f9dbd7dc9f98bf99cb4800436d469adeae5a Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 29 Nov 2016 11:20:42 -0500 Subject: [PATCH] testing pdf view button function from the functions file for gravity forms --- lib/misc.php | 40 ++++++++++++++++++++++---------------- sections/interior-page.php | 5 ++++- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/lib/misc.php b/lib/misc.php index 441e397..90ed0fa 100644 --- a/lib/misc.php +++ b/lib/misc.php @@ -81,20 +81,26 @@ function mytheme_search_loop() { add_action('thematic_searchloop', 'mytheme_search_loop'); // End of the Contextual/Highlight Search functions -//add_action( 'gform_after_submission', 'set_post_content', 10, 2 ); -//function set_post_content( $entry, $form ) { -//// echo '
', print_r($entry), '
'; -// if ( $form['gfpdf_form_settings'] ){ -// -// // get the first array key from gravity forms pdf settings array -// reset($form['gfpdf_form_settings']); -// $pdf_id = key($form['gfpdf_form_settings']); -// -// // get the pdf template that was selected in the gravity pdf settings -// $template = $form['gfpdf_form_settings'][$pdf_id]['template'].'.php'; -// -// // buid url required to view or download pdf forms -// $url = get_site_url() . '/?gf_pdf='. $pdf_id . '&fid='. $form['id'] .'&lid=' . $entry['id'] . '&template=' . $template; -// echo ' View PDF '; -// } -//} +add_action( 'gform_after_submission', 'set_post_content', 10, 2 ); +function set_post_content( $entry, $form ) { + global $url; +// echo '
', print_r($entry), '
'; + if ( $form['gfpdf_form_settings'] ){ + $post = get_post($entry[post_id]); + + // get the first array key from gravity forms pdf settings array + reset($form['gfpdf_form_settings']); + $pdf_id = key($form['gfpdf_form_settings']); + + // get the pdf template that was selected in the gravity pdf settings + $template = $form['gfpdf_form_settings'][$pdf_id]['template'].'.php'; + + // buid url required to view or download pdf forms + $url = get_site_url() . '/?gf_pdf='. $pdf_id . '&fid='. $form['id'] .'&lid=' . $entry['id'] . '&template=' . $template; + + function pdf_view(){ + global $url; + echo ' View PDF '; + } + } +} diff --git a/sections/interior-page.php b/sections/interior-page.php index 5c04a7c..04f7d04 100644 --- a/sections/interior-page.php +++ b/sections/interior-page.php @@ -2,12 +2,15 @@
- +
+

-- 2.17.1