#6438 closed defect (bug) (fixed)
BP Attachment API, warning when no base_dir set
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.3 | Priority: | high |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch |
Cc: |
Description
I've been testing the new BP_Attachment class with a specific case. Well actually it's a case i have to deal with for one of my plugin.
Let's say, you want to use the BP_Attachment class but want to use the WordPress default upload dir. To do so, i haven't specified the base_dir argument of my extending class, but then i get a warning because the `$upload_dir_filter' is empty in this case and the plugin API doesn't find the missing filter.
Then, there's a third parameter we should include to BP_Attachment->upload() method: $time
. I can see cases (my plugin for instance) where we need to attach the file to a post type and make sure the file is saved in a WordPress generated subdirectory of the year and month of the post type's date. Just like it's the case when using directly wp_handle_upload()
.
I suggest to have the patch in before 2.3 release. I'm also adding a unit test.
Looks good to me.