Hook: ipt_fsqm_hook_save_fileupload
Triggered when saved files are updated after a successful submision save.
Hook Uses
Accepts one argument. A reference to IPT_FSQM_Form_Elements_Data
object.
[php]
/**
* Hooks into filesave event during a submission
*
* @param object $obj Reference to IPT_FSQM_Form_Elements_Data object
*/
function hook_fsqm_filesave( $obj ) {
global $wpdb, $ipt_fsqm_info;
// Get the uploaded files
$file_uploads = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$ipt_fsqm_info[‘file_table’]} WHERE data_id = %d", $obj->data_id ) );
// Now do something with the file_uploads
}
add_action( ‘ipt_fsqm_hook_save_fileupload’, ‘hook_fsqm_filesave’, 10, 1 );
[/php]
Source
Located in classes/class-ipt-fsqm-form-elements-data.php.
Filter: ipt_fsqm_files_blacklist
Used to add/remove file extensions from upload blacklists. Added extensions would not be accepted by the file uploader.
Filter Uses
Accepts one argument, an array of file extensions to blacklist.
[php]
/**
* Filters eForm file upload blacklists
* It adds a few more extension to the blacklist
*
* @param array $blacklist Array of blacklisted extensions
*
* @return array
*/
function mod_fsqm_file_blacklists( $blacklist ) {
// Add some more extensions to the blacklist
$blacklist[] = ‘css’;
$blacklist[] = ‘js’;
return array_unique( $blacklist );
}
add_filter( ‘ipt_fsqm_files_blacklist’, ‘mod_fsqm_file_blacklists’, 10, 1 );
[/php]
Source
Located in classes/class-ipt-fsqm-form-elements-uploader.php
.
Filter: ipt_fsqm_files_error_messages
Used to modify error messages thrown by the file uploader element.
Filter Uses
Accepts one argument, an array of error messages. The keys of the array are important and points to a specific error case.
[php]
/**
* Filters the error messages thrown by eForm file uploader element
*
* @param array $error_messages Array of error messages
*
* @return array
*/
function mod_fsqm_file_errormessages( $error_messages ) {
// We can change the error messages using this filter
// Do note that every error message has predefined use
// If you change the key => value parameter of the array
// It may result in error
// The structure of the array is
/*
Array
(
[1] => The uploaded file exceeds the upload_max_filesize directive in php.ini
[2] => The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form
[3] => The uploaded file was only partially uploaded
[4] => No file was uploaded
[6] => Missing a temporary folder
[7] => Failed to write file to disk
[8] => A PHP extension stopped the file upload
[post_max_size] => The uploaded file exceeds the post_max_size directive in php.ini
[max_file_size] => File is too big
[min_file_size] => File is too small
[accept_file_types] => Filetype not allowed
[unallow_file_types] => Filetype is considered dangerous and thereby has been blocked
[max_number_of_files] => Maximum number of files exceeded
[max_width] => Image exceeds maximum width
[min_width] => Image requires a minimum width
[max_height] => Image exceeds maximum height
[min_height] => Image requires a minimum height
[abort] => File upload aborted
[image_resize] => Failed to resize image
[error] => The file could not be uploaded. Possibly the file is corrupt or the system prevented a file tampering attack.
[zero_size] => File is empty. Please upload something more substantial
)
*/
$error_messages[7] = __( ‘Alright our HDD just crashed. We shall get back to you eh?’, ‘domain’ );
return $error_messages;
}
add_filter( ‘ipt_fsqm_files_error_messages’, ‘mod_fsqm_file_errormessages’, 10, 1 );
[/php]
Source
Located in classes/class-ipt-fsqm-form-elements-uploader.php
.