Ability to override for custom folders
-
Hello,
We use a custom folder to store documents that are added to user profiles. With the plugin active, it overrides that, and our files are uploaded to the default location, but our URLs still show the custom folder. Do you have a hook or any way to put a custom subfolder? Our current code (that works without the plugin)”
add_action('admin_init', 'add_admin_functions_empire_register'); function add_admin_functions_empire_register() { if (is_admin()) { $wp_upload_dir = wp_upload_dir(); $protected_folder = trailingslashit($wp_upload_dir['basedir']) . 'verification-docs'; $rules = "Order Deny,Allow\n"; $rules .= "Deny from all"; if( ! @file_get_contents( trailingslashit($protected_folder).'.htaccess' ) ) { wp_mkdir_p( $protected_folder); } @file_put_contents( trailingslashit($protected_folder).'.htaccess', $rules ); add_filter('upload_dir', 'wholesale_customer_docs_directory'); function wholesale_customer_docs_directory( $param ){ global $pagenow; if ( ( 'async-upload.php' == $pagenow || 'media-upload.php' == $pagenow ) && ( false !== strpos( wp_get_referer(),'user-edit.php' ) || false !== strpos( wp_get_referer(),'profile.php' )) ) { $mydir = '/verification-docs'; $param['path'] = $param['path'] . $mydir; $param['url'] = $param['url'] . $mydir; } return $param; } } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Ability to override for custom folders’ is closed to new replies.