I have already updated my Gravity Forms plugin, and I'm trying to change the path of an uploaded image, I'm using the code that is in the change_log.txt:
add_filter("gform_upload_path", "change_upload_path", 20, 2);
function change_upload_path($path_info, $form_id){
$path_info["path"] = "my_new_path";
$path_info["url"] = "http://my_new_url/";
return $path_info;
}
As it didn't work I also used:
add_filter("gform_upload_path_4", "change_upload_path");
function change_upload_path($path_info){
$path_info["path"] = "/new/path/";
$path_info["url"] = "http://new_url.com/images/";
return $path_info;
}
(I have changed the path and url values for my own)
I have noticed that this isn't working and I made the following tests:
- First, I tried changing the priority of the filter.
- I also tried moving the code after the filters "gform_upload_path" and "gform_post_data" (It didn't work)
None of these tests worked, so I added a code inside the filter to see if, at least, it was beeing executed, the code was this:
add_filter("gform_upload_path", "change_upload_path", 20, 2);
function change_upload_path($path_info, $form_id){
print_r($path_info);
exit;
$path_info["path"] = "/new/path/";
$path_info["url"] = "http://new_url.com/images/";
return $path_info;
}
The print_r was never printed, so, the function change_upload_path was never executed by the filter.
My directory has all the needed permissions, in fact, I have already saved the images with my own code but I'd like to use the default filter that you have made for avoid problems with future versions.