Last active
September 29, 2023 09:22
-
-
Save vcat-support/5b5005b28c8961562998bca28d201535 to your computer and use it in GitHub Desktop.
Example on how add one or more extra files into the whole zip 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 one or more extra files into the whole zip archive. | |
* Description: Example on how add one or more extra files into the whole zip archive. | |
* Author: VCAT Consulting GmbH | |
* Author URI: https://www.vcat.de | |
*/ | |
/** | |
* Action to add one or more extra files into the whole zip archive. | |
* | |
* @param ZipArchive $zip The Zip Archive. | |
* @param array $uploaded_files All uploaded files. | |
* @param array $form The form array. | |
*/ | |
function my_bdfgf_extra_files_after_all_files_zipped( $zip, $uploaded_files, $form ) { | |
$wp_upload_dir = wp_upload_dir(); | |
/* | |
* Adds an extra file in zip archive after all uploaded files and folders have passed through the mergetag filter. | |
* | |
* Extra file must be on the server! | |
* | |
*/ | |
$zip->addFile($wp_upload_dir['basedir'] .'/extra_files/information.pdf','new.pdf'); | |
} | |
add_action( 'bdfgf_after_uploaded_files', 'my_bdfgf_extra_files_after_all_files_zipped', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment