我们如何使用提交的表单中的任何字段值更改忍者表单中的PDF名称

时间:2015-11-23 07:48:30

标签: wordpress ninja-forms

我们如何通过提交表单中的字段值更改Ninja表单中的PDF名称

2 个答案:

答案 0 :(得分:0)

function custom_pdf_name( $name, $sub_id ) { 

     global $ninja_forms_processing;
     $form_id= $ninja_forms_processing->get_form_ID();
     $value1 = $ninja_forms_processing->get_field_value( 110 );//110 is id of the field we want to attach with the name of PDF

   if($form_id=='11'){ //11 is id of the form submitted
   $name = 'Form Name -' . $value1;
   }
     return $name; 
  } 
add_filter( 'ninja_forms_submission_pdf_name', 'custom_pdf_name', 20, 2 );

答案 1 :(得分:0)

使用新版本的忍者形式:

function custom_pdf_name( $name, $sub_id ) {
    $sub = Ninja_Forms()->form()->get_sub( $sub_id );
     $name = $sub->get_field_value('title_1542019981951') . $sub_id;
     return $name;
  }
add_filter( 'ninja_forms_submission_pdf_name', 'custom_pdf_name', 20, 2 );