[ad_1]
Using an entry field would only make sense, if you only bulk download all files from a single entry. If you mass download all files for multiple entries, this wouldn’t work.
Also, the filter only sets the initial zip name. You can always choose to safe if under a different name.
If you just need solution for a single entry, this code should do it_
/**
* Filter the file name of the zip archive (without extension) just for the form with ID 2.
*
* @param string $filename The current zip archive file name.
* @param array $form The GF form array.
* @param array $entry_ids The entry IDs of all files being added to the archive.
*
* @return string
*/
function my_bdfgf_download_filename_form_id_1( $filename, $form, $entry_ids ) {
$entry = GFAPI::get_entry( $entry_ids[0] );
$title = rgar( $entry, 3 );
$email = rgar( $entry, 4 );
return $form['title'] . ' – ' . $title . ' – ' . $email;
}
add_filter( 'bdfgf_download_filename_1', 'my_bdfgf_download_filename_form_id_1', 10, 3 );
This would change the ZIP archive name for the form with ID 1 (as used in the filter name) and it would get the title input field from the form with ID 3 and the email field with ID 4. Change these IDs depending on your needs.
On my personal blog, I’ve also explained how these form specific hooks are used:
