WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#10917 closed defect (bug) (fixed)

Uploads are not attached to a post when created using QuickPress

Reported by: iwords Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.8.4
Component: Media Keywords: has-patch
Focuses: Cc:

Description

It is impossible to attach a file or image to a post created using QuickPress on the Dashboard.

Since QuickPress doesn't have an autosave feature like the full-blown editor, a post ID isn't generated until the post is either saved or published - at which point the post's content is cleared from the QuickPress editor, so you can no longer attach a file to it anyway.

Currently, the only way to attach a file or image to a post written in QuickPress is to save it as a draft, then re-edit it using the full editor, which somewhat defeats the object of using QuickPress.

Just to clarify - you can upload images and insert them into the *body* of the post, but you can't upload images and have them stored as attachments using QuickPress at all.

Note: #8932 appears to report a similar issue, but was marked as a duplicate of #9471. I added my feedback to #9471 but was asked to open a new ticket.

Attachments (5)

10917.patch (3.2 KB) - added by ocean90 10 years ago.
10917.2.patch (3.9 KB) - added by ocean90 10 years ago.
This will remove the 'View all' button after saving as draft too.
10917-ajax.patch (5.9 KB) - added by ocean90 10 years ago.
Make it Ajax
10917-ajax+transient.patch (6.5 KB) - added by ocean90 10 years ago.
Transient API
10917-ajax+useroption.patch (6.6 KB) - added by ocean90 10 years ago.
With *_user_option

Download all attachments as: .zip

Change History (18)

#1 follow-up: @nacin
10 years ago

Is this still current?

#2 in reply to: ↑ 1 @blepoxp
10 years ago

Replying to nacin:

Is this still current?

I've confirmed this is still not working correctly. I'll look at it tonight or tomorrow.

#3 @nacin
10 years ago

  • Milestone changed from Unassigned to 3.0

Closing #13277 as a duplicate.

#4 @ocean90
10 years ago

  • Keywords has-patch added

10917.patch solves the problem. We create now an auto-draft and as a result we get an ID which we can use for get_upload_iframe_src().

@ocean90
10 years ago

@ocean90
10 years ago

This will remove the 'View all' button after saving as draft too.

@ocean90
10 years ago

Make it Ajax

#5 @ocean90
10 years ago

Do prevent that on each site load a new post_ID will be generated, I had the idea, to ajaxify the qickpress box.
If the box is closed or not activated there will be no new post_ID. If it's open there will be a new post_ID (auto-draft) and attachments works fine.

#6 @ocean90
10 years ago

Another option would be to save the post_ID as Transient, maybe for one day. If the auto-draft still exists use this otherwise create a new one.

#7 @ocean90
10 years ago

  • Keywords ui-feedback added

nacin and I want to have some UI feedback:
At the moment we use div.message (screen) for the status message. I would like to change it to div.updated (screen).

#8 @johnonolan
10 years ago

Absolutely, massive +1.

@ocean90
10 years ago

Transient API

#9 @ocean90
10 years ago

  • Keywords ui-feedback removed

Added a patch which uses the Transient API to store the post_ID of the auto-draft. For example for two days.

#10 @westi
10 years ago

Patch looks interesting but is not multi-user safe.

I think you need to key the transient on something user specific as well as otherwise two users will end up playing with the same draft if your not careful.

#11 @ocean90
10 years ago

Oh, that's right. So instead of the transient we can save the id as an user option. So each user has now an own quick press auto-draft for maximal 7 days and also we didn't need to delete the post_id like I did it with transient.

@ocean90
10 years ago

With *_user_option

#12 @westi
10 years ago

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

(In [14815]) Ensure that QuickPress media uploads get attached to the auto-draft we create for new posts correctly. Fixes #10917 props ocean90.

#13 @nacin
9 years ago

(In [17743]) Don't load the QuickPress widget via XHR. see #16927. Reverts [16725] as it's no longer needed. Reverts part of [14815], which introduced the behavior, see #10917.

Note: See TracTickets for help on using tickets.