I would like to change the base root directory from "/gravity_forms/" to "/forms/". I found an entry at the forms_mode.php, but I would prefer not to change the plugin files. Can I accomplish this with adding a filter to my functions.php file?
I would like to change the base root directory from "/gravity_forms/" to "/forms/". I found an entry at the forms_mode.php, but I would prefer not to change the plugin files. Can I accomplish this with adding a filter to my functions.php file?
I've just figured out how to do it. Here's the code you need to add to your functions.php file:
add_filter("gform_upload_path", "change_upload_path", 10, 2);
function change_upload_path($path_info, $form_id){
$upload_dir = wp_upload_dir();
$dir_base = $upload_dir["basedir"] . "/gravity_forms/"; //change the base path here
$url_base = $upload_dir["baseurl"] . "/gravity_forms/"; //change the base path here
$subfolders = wp_hash($form_id)."/".date("Y")."/".date("m")."/";
$path_info["path"] = $dir_base.$subfolders;
$path_info["url"] = $url_base.$subfolders;
return $path_info;
}
Glad you figured it out. Thanks for posting your solution for other folks.