I want to get Custom Upload Directory and Gravity Forms playing along together.
Custom Upload Directory allows images that are uploaded throughout the backend, to be saved in a customised directory structure, and Gravity Forms allow users to create posts from the frontend.
When using both together, Custom Upload Directory continues to work nice in the backend, but whenever a user create a post using the frontend form, Gravity Forms ignores the custom path set by Custom Upload Directory plugin.
Someone else have already tried, and I suspect the solution is here: http://bit.ly/P9P6Ao and http://bit.ly/Ph4v23
But it seems to be a hacked solution, and my knowledge of PHP is very limited. I don't know how to apply that solution. I need some guidance and detailed instructions.
Arnav Joy answers:
for gravity form you can change the upload path by using its one of the filter
<?php
add_filter("gform_upload_path", "change_upload_path", 10, 2);
function change_upload_path($path_info, $form_id){
$path_info["path"] = "/new/path/";
$path_info["url"] = "http://yourdomainhere.com/new/path/";
return $path_info;
}
?>
see this
http://www.gravityhelp.com/documentation/page/Gform_upload_path
Ray Vellest comments:
Sorry Arnav, but that alone does not solve the problem.
Arnav Joy comments:
try this , i have not tested it though
<?php
add_filter("gform_upload_path", "change_upload_path", 10, 2);
function change_upload_path($path_info, $form_id){
$customdir = cud_generate_dir();
$path['path'] .= $customdir;
$path['url'] .= $customdir;
$path_info["path"] = $path['path'];
$path_info["url"] = $path['url'] ;
return $path_info;
}
?>
Ray Vellest comments:
No, that does not work. :(
Asad Iqbal answers:
Can't read the link, can you provide a link with public access?
Ray Vellest comments:
Sorry Asad, didn't notice it was a private link. The same issue is discussed here: http://bit.ly/Ph4v23