First add an option in the back-end panel (admin). We should edit the file “settings-options.php” (for me, I’m using webuilder 2011 to edit php files, you can try notepad plus, it highlights the code and you can see lines numbers).
Locate the function : function wpuf_settings_fields() { … }
you can view this part of the code :
array(
‘name’ => ‘attachment_max_size’,
‘label’ => __( ‘Attachment max size’, ‘wpuf’ ),
‘desc’ => __( ‘Enter the maximum file size in <b>KILOBYTE</b> that is allowed to attach’, ‘wpuf’ ),
‘type’ => ‘text’,
‘default’ => ‘2048’
),
You can duplicate this part like this :
array(
‘name’ => ‘attachment_max_size’,
‘label’ => __( ‘Attachment max size’, ‘wpuf’ ),
‘desc’ => __( ‘Enter the maximum file size in <b>KILOBYTE</b> that is allowed to attach’, ‘wpuf’ ),
‘type’ => ‘text’,
‘default’ => ‘2048’
),
array(
‘name’ => ‘attachment_max_size’,
‘label’ => __( ‘Attachment max size’, ‘wpuf’ ),
‘desc’ => __( ‘Enter the maximum file size in <b>KILOBYTE</b> that is allowed to attach’, ‘wpuf’ ),
‘type’ => ‘text’,
‘default’ => ‘2048’
),
Now we need to modify some things in the second block :
array(
‘name’ => ‘attachment_allowed_files’,
‘label’ => __( ‘Allowed files’, ‘wpuf’ ),
‘desc’ => __( ‘Enter here the extensions of the allowed files. By default enter “*” (without the double quotes), this means allow all files’, ‘wpuf’ ),
‘type’ => ‘text’,
‘default’ => ‘*’
),
Now we have finished with the option of allowed files in the admin panel.
Now we should modify another file, in order to have the effect of this option on the front-end.
In the Installation folder of the plugin, locate a folder named “lib”, inside edit the file named “attachment.php”
Locate the line :
$attachment_enabled = wpuf_get_option( ‘allow_attachment’ );
Duplicate it so we need to have :
$attachment_enabled = wpuf_get_option( ‘allow_attachment’ );
$attachment_enabled = wpuf_get_option( ‘allow_attachment’ );
We need to modify the second line :
$attachment_enabled = wpuf_get_option( ‘allow_attachment’ );
$attachment_allowed_files = wpuf_get_option( ‘attachment_allowed_files’ );
Locate at the bottom of these lines this part of code :
‘filters’ => array(array(‘title’ => __( ‘Allowed Files’ ), ‘extensions’ => ‘*’)),
We need to change the string ‘*’ by our new variable like this:
‘filters’ => array(array(‘title’ => __( ‘Allowed Files’ ), ‘extensions’ => $attachment_allowed_files)),
Enjoy it !