WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#15655 closed defect (bug) (invalid)

Media Upload form does not pass tab name

Reported by: jackcrosby Owned by: nacin
Milestone: Priority: normal
Severity: normal Version: 3.0.2
Component: Upload Keywords:
Focuses: Cc:

Description (last modified by ocean90)

The Media Upload form has an error (wp-admin/includes/media.php line #1538). It is not passing the tab name, which hinders adding actions based on which Upload tab is selected.

Error:
Get param 'tab' is being set to 'type' which is incorrect.

$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");

Fix:
To top of function add:

global $tab;

Change the form action URL (line #1538) to:

$form_action_url = admin_url("media-upload.php?type=$type&tab=$tab&post_id=$post_id");

This change also impacts function media_upload_type_url_form (line #1591). Same fix applies.

Attachments (1)

15655.patch (1.2 KB) - added by ocean90 9 years ago.
Patch for jackcrosby's changes

Download all attachments as: .zip

Change History (12)

#1 @ocean90
9 years ago

  • Description modified (diff)

#2 @lloydbudd
9 years ago

  • Keywords has-patch added; upload media tab admin removed

@ocean90
9 years ago

Patch for jackcrosby's changes

#3 @ocean90
9 years ago

  • Milestone changed from Awaiting Review to 3.1

#4 @ryan
9 years ago

  • Milestone changed from 3.1 to Future Release

Punting all tickets that are not regressions in 3.1.

#5 @ocean90
9 years ago

Related: #16220

#6 @ocean90
8 years ago

  • Milestone changed from Future Release to 3.3

#7 @ocean90
8 years ago

Tested the output without the patch

function _ds_test_filter($form_action_url, $type) {
	debug($form_action_url);
	debug($type);
	debug($_REQUEST['tab']);
	debug($_GLOBALS['tab']);
}
add_filter('media_upload_form_url', 'ds_test_filter', 10, 2);

Output after first load, From Computer is active:

string(74) "http://wpms.dev/wp-admin/media-upload.php?type=image&tab=type&post_id=1244"
string(5) "image"
(Notice: Undefined index: tab) NULL
string(4) "type"

From URL is active:

string(74) "http://wpms.dev/wp-admin/media-upload.php?type=image&tab=type&post_id=1244"
string(5) "image"
string(8) "type_url"
string(8) "type_url"

Media Library is active:

string(76) "http://wpms.dev/wp-admin/media-upload.php?type=file&tab=library&post_id=1244"
string(4) "file"
string(7) "library"
string(7) "library"

From Computer is active:

string(74) "http://wpms.dev/wp-admin/media-upload.php?type=image&tab=type&post_id=1244"
string(5) "image"
string(4) "type"
string(4) "type"

#8 @nacin
8 years ago

  • Owner set to nacin
  • Status changed from new to reviewing

#9 @ocean90
8 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.3 to Future Release

This is not a regression in 3.2 and needs some more review.

As you can see from my snippets $_GLOBALS['tab'] does work on all tabs.

#10 @iseulde
6 years ago

  • Keywords needs-patch removed
  • Resolution set to invalid
  • Status changed from reviewing to closed

Media has been redone in 3.5.

#11 @helen
6 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.