Hi,
Yes. This is possible. You just need to manually initialise the PDF plugin before the GF notifications function is called.
For instance:
global $gfpdf;
if(!is_object($gfpdf))
{
$gfpdf = new GFPDF_Core();
}
This will hook into Gravity Form’s notifications filter and attach the PDF (if configured).
When I use the above code I get the following error:
PHP Fatal error: Class ‘GFPDF_Core_Model’ not found in /var/www/wordpress/wp-content/plugins/gravity-forms-pdf-extended/pdf.php on line 180
The GFPDF_Core_Model class gets called during WordPress’s standard ‘init’ action hook. Just make sure you call it after that – e.g.
add_action('init', 'pdf_init', 15); /* note the non-standard call number '15' */
function pdf_init()
{
/* place code in here */
}
Apologies for being a bit thick but does the below code go in the function you specified?
global $gfpdf;
if(!is_object($gfpdf))
{
$gfpdf = new GFPDF_Core();
}
If so then I am getting this error:
PHP Fatal error: Call to undefined method stdClass::assign_index()
Correct. The full code would be:
add_action('init', 'pdf_init', 15); /* note the non-standard call number '15' */
function pdf_init()
{
/* place code in here */
global $gfpdf;
if(!is_object($gfpdf) && class_exists('RGForms')) /* small extra check so no error is thrown when GF is disabled */
{
$gfpdf = new GFPDF_Core();
}
}
Please ensure you are using the latest version of the plugin (3.5.4).
This worked perfectly. I had the order mixed up when I was trying. thank you very much!