Ok so that didn’t work. I’ve been looking into updating the plugin to receive an entry as a param for the filename, but honestly; I don’t see this happening.
So enter my dirtiest code ever, but I’m darned proud of it ??
add_filter('gform_notification', function ($notification, $form, $entry) {
if (isset($notification['attachments']) && count($notification['attachments']) > 0) {
//probably need to build in some check if this the correct attachment; but asuming you only use this one.
$old_filename = $notification['attachments'][0]; // this is acutally the full path to the file.
$new_filename = get_temp_dir() . 'new_filename.xls'; // base this on your $entry value.
// rename the file.
move_uploaded_file($old_filename, $new_filename);
// overwrite the file location for the attachment.
$notification['attachments'][0] = $new_filename;
}
return $notification;
}, 20, 3);
We just rename the file just before we send the file over. This hook HAS the entry data available, so you can use that data anyway you want.
Hope this helps you out; please let me know.