From 0ba9380f4ed3dd969c1b924a90d5dc68e0a38f2b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 26 Nov 2012 23:10:19 +0000 Subject: [PATCH] In media_upload_flash_bypass(), pass the post id in the media-new.php url. In media-new.php, use post_id from REQUEST if passed and the current user can edit the post. Fixes adding media with the browser uploader. Props nacin, ocean90 fixes #22572 git-svn-id: https://develop.svn.wordpress.org/trunk@22853 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/media.php | 9 ++++++++- wp-admin/media-new.php | 13 +++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index b776967485..09e5d81e6c 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2176,9 +2176,16 @@ function wp_media_insert_url_form( $default_view = 'image' ) { * @since 2.6.0 */ function media_upload_flash_bypass() { + $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); + + if ( $post = get_post() ) + $browser_uploader .= '&post_id=' . intval( $post->ID ); + elseif ( ! empty( $GLOBALS['post_ID'] ) ) + $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); + ?>

- browser uploader instead.' ), admin_url( 'media-new.php?browser-uploader' ), '_blank' ); ?> + browser uploader instead.' ), $browser_uploader, '_blank' ); ?>

- +