Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#7219 closed defect (bug) (fixed)

the_media_upload_tabs() always shows first tab as active

Reported by: fuggi's profile fuggi Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.5.1
Component: General Keywords: has-patch tested
Focuses: Cc:

Description

When parameter $_GET[tab] is not passed over to media-upload.php it will show the default tab that is returned by $tab = apply_filters('media_upload_default_tab', 'type');

However the tabbar created by function the_media_upload_tabs() at the top will always show the first tab as active if the parameter is missing:

if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
	$current = $_GET['tab'];
else {
	$keys = array_keys($tabs);
	$current = array_shift($keys);
}

This should be changed so that the default tab in this case is also the default tab:

if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
	$current = $_GET['tab'];
else {
	$current = apply_filters('media_upload_default_tab', 'type');
}

A patch is attached. Another possibility would be to use global $tab; that should already be defined when the function is called.

Attachments (1)

the_media_upload_tabs_media_php.patch (476 bytes) - added by fuggi 17 years ago.
Patch for defect

Download all attachments as: .zip

Change History (5)

@fuggi
17 years ago

Patch for defect

#1 @thee17
17 years ago

  • Milestone set to 2.6

#2 @Denis-de-Bernardy
16 years ago

  • Keywords has-patch tested added; MEdia Tabs removed
  • Milestone changed from 2.9 to 2.8

#3 @ryan
16 years ago

  • Severity changed from major to normal

#4 @azaozz
16 years ago

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

(In [11051]) Properly set the default tab in the uploader, props fuggi, fixes #7219

Note: See TracTickets for help on using tickets.