Can not upload .docx files at Support System

I tried the mu-plugin option (add the code...

<?php
/*
Plugin Name: My Allowed Filetypes for Support
Description: Modifies allowed filetypes for the Support System plugin
*/

function my_custom_allowed_filetypes() {
$allowed_file_types = array(
'jpg' =>'image/jpg',
'jpeg' =>'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'zip' => 'application/zip',
'gz|gzip' => 'application/x-gzip',
'rar' => 'application/rar',
'pdf' => 'application/pdf',
'doc' => 'application/doc',
'doc' => 'application/docx',
'txt' => 'application/txt',
);
}

add_filter( 'incsub_support_allowed_mime_types', 'my_custom_allowed_filetypes' );
?>

But it did not work, my site when load show this error messagem...

Warning: array_keys() expects parameter 1 to be array, null given in /home/bvtre538/public_html/bvcbr/wp-content/plugins/incsub-support/inc/classes/class-shortcodes.php on line 67

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/bvtre538/public_html/bvcbr/wp-content/plugins/incsub-support/inc/classes/class-shortcodes.php on line 71

Warning: implode() [function.implode]: Invalid arguments passed in /home/bvtre538/public_html/bvcbr/wp-content/plugins/incsub-support/inc/classes/class-shortcodes.php on line 73

Currently on WP 4.4.1

Any idea?

  • Michael Bissett

    Hey @Jose, Michael here! :slight_smile:

    When it comes to filtering multiple MIME types, you'll want to do it like this:

    <?php
    
    add_filter( 'incsub_support_allowed_mime_types', 'my_custom_allowed_filetypes' );
    
    function my_custom_allowed_filetypes( $mimes ) {
    
    	$additional_mimes = array(
    		'doc' => 'application/doc',
    		'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    	);
    
    	return array_merge( $mimes, $additional_mimes );
    }

    Your earlier code was effectively wiping out the rules for MIME types, so literally anything could have been uploaded.

    Hope this helps! :slight_smile:

    Kind Regards,
    Michael