WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8205 closed defect (bug) (fixed)

[9663] causes uploads to be stored in /uploads/0000/00/

Reported by: DD32 Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

[9663] Store uploads according to the parent post date when using year/ month sub-directories

results in this for $uploads when attaching to a draft:

array
  'path' => string 'C:\www\wordpress/wp-content/uploads/0000/00' (length=43)
  'url' => string 'http://localhost/wordpress/wp-content/uploads/0000/00' (length=53)
  'subdir' => string '/0000/00' (length=8)
  'basedir' => string 'C:\www\wordpress/wp-content/uploads' (length=35)
  'baseurl' => string 'http://localhost/wordpress/wp-content/uploads' (length=45)
  'error' => boolean false

It appears that _gmt's are not set for drafts, Not sure if the problem is the drafts, or the uploader for not taking it into consideration.

Attachments (1)

8205.diff (699 bytes) - added by DD32 13 years ago.

Download all attachments as: .zip

Change History (8)

#1 @ryan
13 years ago

Drafts purposefully don't have post_date_gmt set. Uploader should take into account.

@DD32
13 years ago

#2 @DD32
13 years ago

  • Keywords has-patch added

#3 @azaozz
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9675]) Fix uploads sub-directory for drafts, props DD32, fixes #8205

#4 @azaozz
13 years ago

It should have been post_date, not post_date_gmt, but having a check there won't hurt.

#5 @DD32
13 years ago

post_date, not post_date_gmt

In that case, current_time('mysql', true); will need to have its 2nd param removed (else it'll default to the current gmt time)

#6 @azaozz
13 years ago

Right, local time is used as default in wp_upload_dir() too.

#7 @azaozz
13 years ago

(In [9676]) Use local time when determining uploads directory, props DD32, see #8205

Note: See TracTickets for help on using tickets.