Skip to content

Tips and Tricks

Jeremy Varnham edited this page Mar 29, 2022 · 3 revisions

Tips and Tricks

Display Blank Page if Nonce is Deleted

The way the plugin works at the moment is that it will generate a nonce using the built-in Wordpress function. If the nonce is modified or one of the query vars is modified it will block access to the PDF with an error message; however, if the nonce is simply deleted, the PDF will still display. A quick workaround to this is to include a check for the presence of a nonce in the URL from within your template file:

$noncefound = ( array_key_exists("nonce", $_GET) );
if ( $noncefound ) {
    // body of template here
}

Include a QR code in your PDF

How about adding a dynamically generated QR code in your PDF based upon data in a Formidable Form field. For example, if you're generating an event attendance certificate or an employment/experience certificate and wish to provide a link to a View that confirms the authenticity of the certificate, you can do this using the plugin Shortcodes Ultimate, which includes a QR code generator that I can confirm works inside a Formidable Pro PDF Extended template file.

Example:

  1. Get the entry key into your template (various ways of doing this).
// if set via URL
$certificatekey = htmlspecialchars( $_GET['certificatekey'] ); 
// or perhaps put the [key] into a View with an appropriate filter, and use:
$certificatekey = FrmViewsDisplaysController::get_shortcode( array( 'id' => 000 ) ); // where 000 is the view id
  1. Create a view that displays the Certificate Valid message and filter it by entry key and [get param=certificatekey].
  2. Insert that view into a page, e.g. Certificate Authenticator
  3. Insert the QR code into your template using do_shortcode as follows:
$qr = do_shortcode('[su_qrcode size="75" data="https://example.com/certificate-authenticator?certificatekey='.$certificatekey.'"]');
Clone this wiki locally