Hello Dana again,
Other "dirty" option maybe???
I know the post title is available during:
public static function create_post($form, &$lead) (in forms_model.php)
I saved it once (some months ago) adding at around 1484 - just before //inserting post
//SASCHA defining variables------------------------------------------------------------------------------------------xxxxxxxxxxxxxxxxxxxxxxxxxxxx-----------------------
global $post_title_from_form;
$post_title_from_form = $post_data["post_title"];
It's not ideal, but I do not mind adding that code on each update :)
That $post_title_from_form is then available in get_file_upload_path (where the gform_upload_path filter is located) at around 1885 when I insert:
global $post_title_from_form;
and then insert/replace:
$target_root = self::get_upload_path($form_id) . "/$currentuserrole/$currentusername/$formtitle/$post_title_from_form/";
$target_root_url = self::get_upload_url($form_id) . "/$currentuserrole/$currentusername/$formtitle/$post_title_from_form/";
Before I knew about the filter I "hardcoded" that path using $post_title_from_form as above (after I cleaned it up of course). Again that is not ideal! I rather use the filter!
Is there a way of somehow making that variable ($post_title_from_form) available in your filter function change_upload_path from your snippet? Then all I need to do is put in those lines defining that variable each time I update...
Anyway, any pointers would be great, as I am "desperate" to keep the uploaded files/images together in a directory based on the post title!
Posted 13 years ago on Friday November 25, 2011 |
Permalink