WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 8 weeks ago

#23831 new defect (bug)

Insert Into Post for Audio / Video doesn't always work

Reported by: wonderboymusic Owned by:
Priority: normal Milestone: 3.6
Component: Post Formats Version: trunk
Severity: normal Keywords: has-patch commit
Cc:

Description

As Otto pointed out, "Link To" can be set to "None" which was sending a broken shortcode to the editor. The HTML sent to the editor should be based on what is selected using "Link To" in the Media modal.

Attachments (8)

23831.diff (2.6 KB) - added by wonderboymusic 3 months ago.
23831.2.diff (5.0 KB) - added by wonderboymusic 3 months ago.
23831.3.diff (5.0 KB) - added by wonderboymusic 2 months ago.
23831.4.diff (5.0 KB) - added by wonderboymusic 2 months ago.
23831.5.diff (655 bytes) - added by wonderboymusic 2 months ago.
flashmediaelement.swf (28.0 KB) - added by wonderboymusic 2 months ago.
23831.6.diff (71.6 KB) - added by wonderboymusic 2 months ago.
23831.7.diff (390 bytes) - added by kovshenin 2 months ago.

Download all attachments as: .zip

Change History (33)

wonderboymusic3 months ago

comment:1 wonderboymusic3 months ago

the attached patch makes the shortcode always work, but doesn't change when the Link To option changes. Working on that next.

comment:2 lancewillett3 months ago

  • Keywords needs-refresh added

Is this still a bug?

comment:3 wonderboymusic3 months ago

Will in-westi-gate

comment:4 wonderboymusic3 months ago

  • Keywords commit added; needs-refresh removed

this is still necessary - the patch still applies cleanly and needs to be committed, but the ticket shouldn't be closed yet, need to decide what to do when someone selects "Link to Attachment Page" or whatever

comment:5 wonderboymusic3 months ago

this is mainly for the content editor, not the format meta

comment:6 markjaquith3 months ago

In 23870:

Fix some Insert-into-Post for Audio/Video bugs.

props wonderboymusic. see #23831.

wonderboymusic3 months ago

comment:7 follow-up: wonderboymusic3 months ago

attachment:23831.2.diff​ enforces dimensions for video, when present, in all cases. The post format meta for video is now a shortcode, so the dimensions don't have to be looked up on the fly. For audio and video, the meta can be an attachment id, url, HTML embed code, or a shortcode

Introduces attachment_url_to_postid() which will try to convert a URL containing a home_url() front into post ID by looking at the guid column for an attachment in the posts table

The issue Otto brought up, which is the original reason for this ticket, still exists. The question is: should the content change for Insert Into Post for audio or video when the user selects the custom, file, post or none URL option. As it stands, all insert the proper shortcode, there is no difference based on that selection

comment:8 in reply to: ↑ 7 ; follow-up: azaozz2 months ago

Replying to wonderboymusic:

Introduces attachment_url_to_postid() which will try to convert a URL containing a home_url() front into post ID by looking at the guid column for an attachment in the posts table

This will not work on many sites. The guid is _not_ the url to an attachment when the site or the uploads directory has been moved. To do something like this you will need to look at _wp_attached_file post meta, etc. Check out wp_get_attachment_url().

wonderboymusic2 months ago

comment:9 wonderboymusic2 months ago

Refreshed against latest trunk

comment:10 SergeyBiryukov2 months ago

Wouldn't url_to_postid() work for attachments? From my testing, it does.

comment:11 wonderboymusic2 months ago

last I checked, only checks attachment page, not the actual file

comment:12 wonderboymusic2 months ago

I am going to redo that func as per Ozz

comment:13 SergeyBiryukov2 months ago

Replying to wonderboymusic:

last I checked, only checks attachment page, not the actual file

Indeed, I only tested with attachment pages.

wonderboymusic2 months ago

comment:14 markjaquith2 months ago

In 23969:

Enforce video dimensions.

props wonderboymusic. see #23831.

wonderboymusic2 months ago

comment:15 wonderboymusic2 months ago

23831.5.diff fixes the 404 - dynamic rendering of file types that trigger Flash or Silverlight was the issue

comment:16 markjaquith2 months ago

23831.5.diff doesn't fix the 404 for me. The 404 happens on the front end and the back end. This fixes neither for me.

comment:17 wonderboymusic2 months ago

Can you confirm your cache is empty? I was able to reproduce the error repeatedly until I cleared Chrome browser cache

comment:18 markjaquith2 months ago

My cache is completely empty. Multiple browsers. Still can reproduce the issue.

Did you upload the wrong patch or forget to add a file to the stage? Looking at .5.diff, I can't imagine why you'd think that would have any effect on the front of the site.

comment:20 wonderboymusic2 months ago

It still works for me locally, not sure what is up - I pasted the URL on GitHub

wonderboymusic2 months ago

comment:21 wonderboymusic2 months ago

23831.6.diff + flashmediaelement.swf​ are latest for MEjs 2.11.3 - works for me... could use other testers. Need to select videos that trigger the Flash or Silverlight plugin so that we can confirm the .swf and .xap paths aren't 404ing

comment:22 markjaquith2 months ago

In 23977:

Update MediaElement.js to 2.11.3

props wonderboymusic, John Dyer. see #23831.

kovshenin2 months ago

comment:23 kovshenin2 months ago

Missed a semicolon in [23870], see 23831.7.diff.

comment:24 SergeyBiryukov2 months ago

In 23998:

Add missing semicolon. props kovshenin. see #23831.

comment:25 in reply to: ↑ 8 SergeyBiryukov8 weeks ago

Replying to azaozz:

Replying to wonderboymusic:

Introduces attachment_url_to_postid() which will try to convert a URL containing a home_url() front into post ID by looking at the guid column for an attachment in the posts table

This will not work on many sites. The guid is _not_ the url to an attachment when the site or the uploads directory has been moved. To do something like this you will need to look at _wp_attached_file post meta, etc. Check out wp_get_attachment_url().

Sounds like a valid concern to me.

Note: See TracTickets for help on using tickets.