Plugin Author
ulfben
(@ulfben)
I’ve never tried to upload anything without a post to attach it to. I’ll have to look into that for the next release.
Would you mind sharing your use case? Eg. why does anyone upload non-post related files to a blog?
I’ve done it to include header images in a post which uses a gallery. If the image is attached to the post, the image will show up both at the top of the post and in the gallery. We also include photos on our author bio pages, and there’s not a way to upload into that (it just pulls from the user profile). I think there have been some other cases too, but those are the first that come to mind.
Thank you! =)
Plugin Author
ulfben
(@ulfben)
Sure. In the first case I’ve always opted to use the gallery exclude=”” parameter, but I know that wasn’t available (without plugins) a couple of release ago.
I’ll have to figure out some reasonable defaults for some of the post-exclusive path components, or perhaps add a second field controlling uploads without post relation.
Anyway, I’ll make sure to test the “stand alone” Media Gallery properly in the future. Thanks for bringing it to my attention.
Unattached images upload to 1970/01/01. please solve this problem!
My files also keep getting uploaded to 1970/01/01
Does anyone know how to fix this please?
ulfben, can you please help us with this issue?
Thanks,
mrinspire
Try this:
in custom_upload_dir.php\custom_upload_dir.php ~li 92:
if($want_year || $want_month || $want_day){ //make sure the post date has been set.
if($post->post_status == 'auto-draft' || $post->post_date == '0000-00-00 00:00:00'){
return array('error' => __('Custom Upload Dir: no post date found. Please *name* & *save* the post draft before uploading.', 'cud'))
}
//[alx359] fix when loading directly from media uploader with no post/id to refer
//$time = strtotime($post->post_date);
$time = (!empty($post)) ? strtotime($post->post_date) : $_SERVER['REQUEST_TIME'];
}
Plugin Author
ulfben
(@ulfben)
Thanks alx359!
I’ve committed 3.0.2 now; it includes your fix and a fix to the author name that never worked properly.
Please try it out and let me know if there’s problems.
Thank to you, ulfben, for sharing this useful plugin with us!