Need help identifying the correct parameter to pass through my filter
-
My goal:
When one of our users chooses to download a pdf, that chosen pdf then passes through my filter to append a footer containing contact information via FPDI/FPDF.What I need help with:
Identifying the correct parameter used by Download Monitor to have this happen. I have done most of the work as you can see below, so hopefully you can help.add_filter( 'dlm_file_path', 'Auto_Custom_Flyer'); use setasign\Fpdi\Fpdi; function Auto_Custom_Flyer() { require('wp-content/themes/enfold-child/FPDF/fpdf.php'); require_once('wp-content/themes/enfold-child/FPDI/src/autoload.php'); $current_user = wp_get_current_user(); $user_headshot = get_avatar_url(wp_get_current_user()); $file_path = ANY_PDF_DOWNLOAD_BY_USER; $pdf = new Fpdi(); $pdf->AddPage('P', 'Letter'); $pdf->setSourceFile( $file_path ); $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx, 0,0,215.9); $pdf->Line(9.525, 209, 206.375, 209); $pdf->SetFont('Helvetica'); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(10); $pdf->SetXY(41, 215); $pdf->MultiCell(150,5,"$current_user->display_name \nLoan Officer \nNMLS #123456 \n\n555-555-5555 \n$current_user->user_email"); $pdf->SetFont('Helvetica'); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(7); $pdf->SetXY(9.525, 250); $pdf->MultiCell(0,3,"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); $pdf->Image($user_headshot,9.525,216,28,0,'JPEG'); $pdf->Output(); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Need help identifying the correct parameter to pass through my filter’ is closed to new replies.