WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#7219 closed defect (bug) (fixed)

the_media_upload_tabs() always shows first tab as active

Reported by: 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 6 years ago.
Patch for defect

Download all attachments as: .zip

Change History (5)

fuggi6 years ago

Patch for defect

comment:1 thee176 years ago

  • Milestone set to 2.6

comment:2 Denis-de-Bernardy5 years ago

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

comment:3 ryan5 years ago

  • Severity changed from major to normal

comment:4 azaozz5 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.