Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vcat-support/600ffe67054d34a546bcfa155bf978e0 to your computer and use it in GitHub Desktop.
Save vcat-support/600ffe67054d34a546bcfa155bf978e0 to your computer and use it in GitHub Desktop.
Example to add extra files to the zip archive. The file is added to all folder inside the Archive.
<?php
/**
* Plugin Name: Bulk Download for Gravity Forms - Add extra files to zip archive.
* Description: Example to add extra files to the zip archive. The file is added to all folder inside the Archive.
* Author: VCAT Consulting GmbH
* Author URI: https://www.vcat.de
*/
/**
* Filter to add extra files into a single entry.
*
* @param array $uploaded_files All uploaded files.
* @param int $entry_id The entry ID .
* @param array $form The form array.
*
* @return array
*/
function my_bdfgf_extra_files_single_entry( $uploaded_files, $entry_id, $form ) {
/*
* Add extra file to the zip archive.
* Extra file must be on the server!
*
*/
$wp_upload_dir = wp_upload_dir();
$uploaded_files[$entry_id][] = $wp_upload_dir['basedir'] .'/extra_files/Information.pdf';
return $uploaded_files;
}
add_filter( 'bdfgf_single_entry_uploaded_files', 'my_bdfgf_extra_files_single_entry' , 10 , 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment