I had some issues a week or so ago getting a custom view PDF to attach to admin and applicant notifications.
Rob LeVine helped me sort it out with the code blow and it worked great for the two forms I had at the time.
I've now duplicated one of those forms and added a new View for it and as far as I can tell I've updated all the different settings but nothing is attaching to either email. The link that appears on the confirmation page [frm-pdf view=597 entry="[id]" public=1] is working correctly.
This is the original code I had:
add_filter( 'frm_pdfs_email_attachment_args', 'add_view_to_attached_pdf', 10, 2 ); function add_view_to_attached_pdf( $pdf_args, $args ) { $args_set = false; switch($args['form']->id) { case 6: $pdf_args['view'] = 554; $args_set = true; break; case 7: $pdf_args['view'] = 574; $args_set = true; break; default: break; } if ($args_set) { $pdf_args['id'] = $args['entry']->id; // Do this to show the detail view, otherwise, it shows the listing view. return $pdf_args; } }
This is how I updated it to include the new form ID 8 and View ID 597:
add_filter( 'frm_pdfs_email_attachment_args', 'add_view_to_attached_pdf', 10, 2 );
function add_view_to_attached_pdf( $pdf_args, $args ) {
$args_set = false;
switch($args['form']->id) {
case 6:
$pdf_args['view'] = 554;
$args_set = true;
break;
case 7:
$pdf_args['view'] = 574;
$args_set = true;
break;
case 8:
$pdf_args['view'] = 597;
$args_set = true;
break;
default:
break;
}
if ($args_set) {
$pdf_args['id'] = $args['entry']->id; // Do this to show the detail view, otherwise, it shows the listing view.
return $pdf_args;
}
}
Can anyone tell me what I've missed? TIA
Hi - yes, I'm sure. I've attached a screenshot showing the View ID and the Form ID. I also tried doing the entire thing again with a new form and new view and same issue. No attachments. The PDF form isn't attaching and neither are documents submitted through file upload fields. Works perfectly on the first form but not at all on the new ones.
Not sure why you would be getting a security warning from the link? That's very strange.
The only thing I can think of is there's a server-side error. Have you set up WP debugging and see if anything is getting written into the log file?
Please login or Register to submit your answer
And in case it helps here is the link to the form in question...
https://huntprosperity.com.au/stonepoint-application/
Your link is triggering security warnings so I'm not going to visit the form. Are you certain the duplicated form id is 8?