Make WordPress Core

Opened 17 years ago

Closed 10 years ago

Last modified 10 years ago

#6820 closed enhancement (fixed)

Make it possible to manually detach/attach post images

Reported by: matt's profile matt Owned by: matt's profile matt
Milestone: 4.2 Priority: low
Severity: minor Version:
Component: Media Keywords: has-patch dev-feedback 4.2-beta
Focuses: ui Cc:

Description

You should be able to change the parent of an attachment to attach it to a different post.

Attachments (9)

detach_media.diff (5.8 KB) - added by dphiffer 14 years ago.
AJAX-style media detaching with bulk option
detach_media2.diff (6.6 KB) - added by dphiffer 14 years ago.
Updated after getting some feedback from nacin
6820.diff (6.3 KB) - added by wonderboymusic 10 years ago.
6820.2.diff (5.1 KB) - added by wonderboymusic 10 years ago.
6820.3.diff (9.9 KB) - added by wonderboymusic 10 years ago.
6820.4.diff (9.4 KB) - added by wonderboymusic 10 years ago.
6820.5.diff (9.5 KB) - added by wonderboymusic 10 years ago.
Screen Shot 2015-03-05 at 8.24.26 AM.png (667.0 KB) - added by ryan 10 years ago.
IMG_3310.PNG (143.2 KB) - added by ryan 10 years ago.
iPhone 5 screenshot, for the record. The "Uploaded to" column doesn't show on mobile.

Download all attachments as: .zip

Change History (56)

#1 @DD32
16 years ago

  • Component changed from Administration to Gallery
  • Keywords needs-patch added

#2 @Denis-de-Bernardy
16 years ago

  • Keywords 2nd-opinion added
  • Priority changed from normal to low
  • Severity changed from normal to minor

Isn't this done automatically when an attachment has no parent?

Also, wouldn't it be more reliable to duplicate the attachment, with a new parent, when it gets inserted in a separate post?

#5 @Denis-de-Bernardy
15 years ago

  • Keywords blessed 2nd-opinion removed

#6 @ryan
15 years ago

  • Milestone changed from 2.9 to Future Release

#7 @dphiffer
14 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#8 @dphiffer
14 years ago

  • Cc dan@… added

@dphiffer
14 years ago

AJAX-style media detaching with bulk option

#9 @scribu
14 years ago

  • Cc scribu added

@dphiffer
14 years ago

Updated after getting some feedback from nacin

#10 @WraithKenny
14 years ago

  • Cc Ken@… added

#11 @TomAuger
13 years ago

  • Cc TomAuger added

#12 @lkraav
13 years ago

  • Cc lkraav added

#13 @sabreuse
13 years ago

  • Cc sabreuse@… added

#14 @aaroncampbell
13 years ago

  • Cc aaroncampbell added

#15 @SergeyBiryukov
13 years ago

Closed #14042 and #15557 as duplicates.

Last edited 13 years ago by SergeyBiryukov (previous) (diff)

#16 @Mamaduka
13 years ago

  • Cc georgemamadashvili@… added

#17 @ruud@…
12 years ago

  • Cc ruud@… added

#18 @knutsp
12 years ago

  • Cc knut@… added

#19 @SergeyBiryukov
12 years ago

#22675 was marked as a duplicate.

#20 @DrewAPicture
10 years ago

  • Summary changed from Post image / attachment reparenting to Make it possible to manually detach/attach post images

#21 @DrewAPicture
10 years ago

  • Component changed from Gallery to Media
  • Focuses ui added

#22 @DrewAPicture
10 years ago

#14042 was marked as a duplicate.

@wonderboymusic
10 years ago

#23 @wonderboymusic
10 years ago

  • Keywords needs-testing removed
  • Milestone changed from Future Release to 4.2

6820.diff Adds a Detach link for Media Grid attachment details modal and for list table rows. Haven't done bulk yet

#24 @DrewAPicture
10 years ago

  • Keywords needs-refresh added

6820.2.diff needs a refresh, and it sounds like a treatment for bulk actions per comment:23. Screenshots would be nice too.

#25 @wonderboymusic
10 years ago

In 31619:

Allow attachments to be Detached from their parent in media grid and list modes.

See #6820.

#26 @DrewAPicture
10 years ago

  • Keywords needs-docs added; needs-refresh removed

wp_media_attach_action() parameter docs are incomplete.

#27 @ryan
10 years ago

Looking forward to the day when users don't ever see the terms attach or detach. This whole thing is a hack around the lack of API for getting images from content.

#28 @wonderboymusic
10 years ago

In 31624:

detached affects the wp() call for the media list table, so switch our new $_GET key to detach.

See #6820.

@ryan
10 years ago

iPhone 5 screenshot, for the record. The "Uploaded to" column doesn't show on mobile.

#29 follow-up: @DrewAPicture
10 years ago

  • Keywords dev-feedback 4.2-beta added

@ryan: What would be your recommendation on the "Uploaded To" column on mobile? Should it actually show? Seems like adding a fourth column would make that even more unnecessarily scrunched.

#30 @Stagger Lee
10 years ago

Would it be helpful to show them on very small devices like this ?

  • Image bigger and centered above.
  • Other columns as display:block beneath centered image.

Scrolling with Smartphones goes very fast and easy, so height would not make such difference and problems.

Problem is header would be repeated for each item. If this could be solved in some way. Image doesnt need header title, it is self explanatory.

Last edited 10 years ago by Stagger Lee (previous) (diff)

#31 in reply to: ↑ 29 ; follow-up: @ryan
10 years ago

Replying to DrewAPicture:

@ryan: What would be your recommendation on the "Uploaded To" column on mobile? Should it actually show? Seems like adding a fourth column would make that even more unnecessarily scrunched.

I think list tables on mobile should be one column. We should decide what needs to be exposed on mobile and make some editorial decisions. Related: #29993. And #29991, #29992, #29994, #29995.

Failing that, I'd leave Uploaded To hidden and keep attach/detach off of mobile. The attach modal likely needs work on mobile, and since detach has no confirmation I will almost certainly accidentally tap it while scrolling.

Someday, let's discuss how to kill the notion of attached and detached. I end up with unattached images all the time because I often share straight to the media lib from mobile and later blog from desktop (making galleries on mobile is difficult). Images uploaded to the media lib don't get attached to posts when they are later published. This messes up filtering down to images uploaded to the post and messes up reader plugins (which are still reliant on attached status and featured images and don't have API for getting all images in content). Instead of making users manually attach images, we should pursue attachment independence further. Galleries no longer depend on attached status. Let's finish the job.

Last edited 10 years ago by ryan (previous) (diff)

#32 @knutsp
10 years ago

Also related: #30691

#33 in reply to: ↑ 31 @helen
10 years ago

Replying to ryan:

since detach has no confirmation

We should probably do something about that in the meantime.

This ticket was mentioned in Slack in #core by drew. View the logs.


10 years ago

#35 follow-ups: @melchoyce
10 years ago

Someday, let's discuss how to kill the notion of attached and detached. I end up with unattached images all the time because I often share straight to the media lib from mobile and later blog from desktop (making galleries on mobile is difficult). Images uploaded to the media lib don't get attached to posts when they are later published. This messes up filtering down to images uploaded to the post and messes up reader plugins (which are still reliant on attached status and featured images and don't have API for getting all images in content). Instead of making users manually attach images, we should pursue attachment independence further. Galleries no longer depend on attached status. Let's finish the job.

I admit that when I saw this ticket pop up, that was my first thought — why do we even have attached/detached? I'm honestly barely even sure I understand what it really means. Is it still used for anything? I'm sure the vast majority of users don't know and don't care — they just want to add and remove images from their post content. Attach/detach feels like an irrelevant concept in today's WordPress.

#36 in reply to: ↑ 35 @aaroncampbell
10 years ago

Replying to melchoyce:

I admit that when I saw this ticket pop up, that was my first thought — why do we even have attached/detached? I'm honestly barely even sure I understand what it really means. Is it still used for anything? I'm sure the vast majority of users don't know and don't care — they just want to add and remove images from their post content. Attach/detach feels like an irrelevant concept in today's WordPress.

I agree, as far as core, but I think it's likely that numerous plugins leverage these relations quite a bit. The real problem, in my opinion, isn't the idea that media can be attached to a post, it's that it can only be attached to a single post (it uses post parent). It really becomes the classic post-to-post relation issue though, which we don't solve for other post types, so maybe we shouldn't try to solve it for media either?

#37 in reply to: ↑ 35 ; follow-up: @afercia
10 years ago

Replying to melchoyce:

why do we even have attached/detached? I'm honestly barely even sure I understand what it really means. Is it still used for anything? I'm sure the vast majority of users don't know and don't care

That comes from a developer's point of view, giving how attached media are stored in the DB and then fetched, especially how media meta data are fetched. Of course this doesn't make any sense from a user's perspective, as you pointed out, users just want to add and remove images.
Maybe time to consider a DB schema upgrade? After all, media inside a post are content and maybe media IDs should be stored in the post itself.

#38 in reply to: ↑ 37 ; follow-up: @helen
10 years ago

Replying to afercia:

Maybe time to consider a DB schema upgrade?

Congratulations, you have arrived at #14513. You should now consider yourself a seasoned WordPress core contributor (if you don't already). :)

I am actually rather inclined to revert this and leave it to existing plugins. If somebody's site relies on attach/detach functionality today, that is completely understandable, but I don't think we should go back to emphasizing these under-the-hood concepts by default.

#39 @helen
10 years ago

I should note that it may be okay to leave in the list table (adding an AYS), though, since it has the column and attachment modal and I don't see us killing that off since it's almost like a legacy mode right now. The Backbone-ified version doesn't show anything if it's not attached to something, though, so I'd rather not start showing "Detach" there.

This ticket was mentioned in Slack in #core by drew. View the logs.


10 years ago

#41 @husobj
10 years ago

I have used (and created) many plugins that rely on the attachment -> post as parent relationship so until such time as #14513 becomes a possibility I think we have to keep this functionality.

However, I would agree with @helen that we don't need to "emphasise these under-the-hood concepts" by default.
There are quite a few plugins that add attach/detach functionality and UI, and I'm not sure that this needs to be added to core until the future of a post relationship schema is more certain?

#42 in reply to: ↑ 38 @DrewAPicture
10 years ago

Replying to helen:

I am actually rather inclined to revert this and leave it to existing plugins. If somebody's site relies on attach/detach functionality today, that is completely understandable, but I don't think we should go back to emphasizing these under-the-hood concepts by default.

I agree that a revert is the best option at this stage.

#43 @DrewAPicture
10 years ago

  • Keywords needs-docs removed

#44 @wonderboymusic
10 years ago

I semi-agree with the JS parts, but not with reverting "detach" in general. I agree Attach/Detach is lame, but if you are going to have Attach in the list table, there should be Detach.

When you upload an image using the media modal on the Post screen, and then decide to not use that image in the post, you are still stuck with this relationship which affects the attachment forever. Namely, its URL.

http://woo.com/2015/03/17/drew-jaynes/unrelated-media-that-i-didnt-attach/

Having the Detach link allows the Drew Jaynes related portion the URL to go in the dumpster, and this strange post relationship to disappear. If indeed you are using something like [gallery], you might expect these URLs to operate this way.

This ticket was mentioned in Slack in #core by kraft. View the logs.


10 years ago

#46 @wonderboymusic
10 years ago

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

In 31960:

Remove the JS part of [31619].

Fixes #6820.

#47 @nacin
10 years ago

I'll point out that leaving this in for 4.2, does not, in my opinion, prevent us from completely removing *both* Attach and Detach in the future. I agree with having it for now, but eventually it'd be nice to have the option to sandbag it.

Note: See TracTickets for help on using tickets.