gpfr_filename
Description
Filter the renamed filename.
Usage
Apply to all fields and forms.
add_filter( 'gpfr_filename', 'my_custom_function', 10, 3 );Apply to all fields on a specific form.
add_filter( 'gpfr_filename_FORMID', 'my_custom_function', 10, 3 );Apply to a specific field on a specific form.
add_filter( 'gpfr_filename_FORMID_FIELDID', 'my_custom_function', 10, 3 );Parameters
renamed_file string
Renamed filename.
file string
The original filename.
entry array
The properties of the entry including field values.
form array
The current form.
field \GF_Field
The current field.
Examples
Global Filename Template
1
2
3
4
5
6
7
8
9
10
11
12
<?php
/**
* Gravity Perks // File Renamer // Global Filename Template
* https://gravitywiz.com/documentation/gravity-forms-file-renamer/
*
* This snippet puts all files in an entry-specific subfolder and increments the filename with its count.
*
* Requires GP File Renamer v1.0.5+.
*/
add_filter( 'gpfr_filename_template', function ( $template, $filename, $form, $field, $entry ) {
return '{entry:id}/{filename}-{i}';
}, 10, 5 );Lowercase All Filenames
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
/**
* Gravity Perks // GP File Renamer // Lowercase All Filenames
* https://gravitywiz.com/documentation/gravity-forms-file-renamer/
*
* This snippet will automatically lowercase all filenames.
*/
add_filter( 'gpfr_filename', function( $renamed_file, $file, $entry ) {
// Important note, $renamed_file is the entire path.
$lowercase_filename = strtolower( wp_basename( $renamed_file ) );
return str_replace( wp_basename( $renamed_file ), $lowercase_filename, $renamed_file );
}, 10, 3 );Since
This filter is available since Gravity Forms File Renamer 1.0.
The $form and $field parameters were added in File Renamer 1.0.5.
All Connections
All Perks
- GF Address Autocomplete
- GF Advanced Calculations
- GF Advanced Phone Field
- GF Advanced Save & Continue
- GF Advanced Select
- GF Auto List Field
- GF Auto Login
- GF Better User Activation
- GF Blocklist
- GF Bookings
- GF Conditional Logic Dates
- GF Conditional Pricing
- GF Copy Cat
- GF Date Time Calculator
- GF Disable Entry Creation
- GF Easy Passthrough
- GF eCommerce Fields
- GF Email Users
- GF Email Validator
- GF Entry Blocks
- GF Expand Textareas
- GF File Renamer
- GF File Upload Pro
- GF Inventory
- GF Limit Checkboxes
- GF Limit Dates
- GF Limit Submissions
- GF Live Preview
- GF Media Library
- GF Multi-Page Navigation
- GF Nested Forms
- GF Notification Scheduler
- GF Page Transitions
- GF Pay Per Word
- GF Populate Anything
- GF Post Content Merge Tags
- GF Preview Submission
- GF Price Range
- GF QR Code
- GF Randomizer
- GF Read Only
- GF Reload Form
- GF Submit to Access
- GF Terms Of Service
- GF Unique ID
- GF Word Count