Hi @pirenko,
The file you’ve added is only a renderer for the excel. You need to add the request hook too. So the complete code would look like this, after which you can download the file by going to: <yoursite.ext>/gf-entries-in-excel/super_secret <- please change that 😉
include_once "MultiFormSingleSheetRenderer.php";
use GFExcel\GFExcel;
use GFExcel\GFExcelOutput;
add_action('request', function ($query_vars) {
// only respond to a plugin call
if (!array_key_exists(GFExcel::KEY_ACTION, $query_vars) ||
!array_key_exists(GFExcel::KEY_HASH, $query_vars) ||
$query_vars[GFExcel::KEY_ACTION] !== GFExcel::$slug) {
return $query_vars;
}
// Set this super secret key to something only u know.
$secret = 'super_secret'; // <- This is the part that goes in the url.
if ($query_vars[GFExcel::KEY_HASH] !== $secret) {
return $query_vars;
}
// instantiate multi sheet renderer and push all forms to it.
$renderer = new MultiFormSingleSheetRenderer();
foreach (GFFormsModel::get_form_ids() as $form_id) {
$output = new GFExcelOutput((int) $form_id, $renderer);
$output->render();
}
// start the rendering and the download.
$renderer->renderOutput();
exit;
}, 9);
Please note that this is NOT part of the plugin, but a hack specific for this use case. It is possible that in the near future i’ll release a new version of the plugin, that cannot handle this code. So please keep that in mind 🙂 Should be save within the 1.x.x version of the plugin.
Doeke,
Thank you very much!
This worked perfectly.
Thanks once again for this great plugin!