Skip to content

Commit 21ebae0

Browse files
committed
Fixed the issue of {entry_id} smart tag not working correctly (by switching to using the wpforms_process_entry_saved action instead of wpforms_process_after_filter)
1 parent ac5a6f2 commit 21ebae0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pdf-forms-for-wpforms.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class Pdf_Forms_For_WPForms
2626
{
2727
const VERSION = '1.3.0';
28-
const MIN_WPFORMS_VERSION = '1.6.9';
28+
const MIN_WPFORMS_VERSION = '1.7.7';
2929
const MAX_WPFORMS_VERSION = '1.9.99';
3030
private static $BLACKLISTED_WPFORMS_VERSIONS = array();
3131

@@ -81,8 +81,10 @@ public function plugin_init()
8181
add_filter( 'wpforms_save_form_args', array( $this, 'wpforms_save_form_args' ), 10, 3 );
8282

8383
add_filter( 'wpforms_smarttags_process_value', array( $this, 'plaintext_smart_tag_value_workaround_filter' ), PHP_INT_MAX, 6 );
84-
// fill_pdfs: we can't use wpforms_process_complete (because notifications have already been sent) and wpforms_process because uploaded files haven't been processed yet
85-
add_filter( 'wpforms_process_after_filter', array( $this, 'fill_pdfs' ), 999999, 3 );
84+
// fill_pdfs: we can't use wpforms_process_complete (because notifications have already been sent)
85+
// and wpforms_process because uploaded files haven't been processed yet
86+
// we need entry_id as well, which is only provided to wpforms_process_entry_saved
87+
add_action( 'wpforms_process_entry_saved', array( $this, 'fill_pdfs' ), 99, 4 );
8688
add_action( 'wpforms_process_complete', array( $this, 'remove_tmp_dir' ), 99, 0 );
8789
add_filter( 'wpforms_emails_send_email_data', array( $this, 'attach_files' ), 10, 2 );
8890
add_action( 'wpforms_frontend_confirmation_message', array( $this, 'change_confirmation_message'), 10, 4 );
@@ -876,12 +878,10 @@ public function plaintext_smart_tag_value_workaround_filter( $value, $tag_name,
876878
/**
877879
* We need to fill the pdf's document fields and then create attachment file and attach them
878880
*/
879-
public function fill_pdfs( $wpforms_fields, $entry, $form_data )
881+
public function fill_pdfs( $wpforms_fields, $entry, $form_data, $entry_id )
880882
{
881883
try
882884
{
883-
$entry_id = $entry["id"];
884-
885885
$attachments = array();
886886
$mappings = array();
887887
$embeds = array();
@@ -1428,8 +1428,6 @@ public function fill_pdfs( $wpforms_fields, $entry, $form_data )
14281428
$this->remove_tmp_dir();
14291429
$this->wpforms_mail_attachments = array();
14301430
}
1431-
1432-
return $wpforms_fields;
14331431
}
14341432

14351433
/**

0 commit comments

Comments
 (0)