Last active
September 29, 2023 09:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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