Custom View PDF not attaching to new duplicate form

By: Barbara Smith | Asked: 05/12/2024
ForumsCategory: General questionsCustom View PDF not attaching to new duplicate form
Barbara Smith asked 7 months ago
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
Barbara Smith replied 7 months ago

And in case it helps here is the link to the form in question...

Victor Font replied 7 months ago

Your link is triggering security warnings so I'm not going to visit the form. Are you certain the duplicated form id is 8?

2 Answers
Barbara Smith answered 7 months ago
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.
Attachments
Rob LeVineRob LeVine answered 7 months ago
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?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right