[wp-trac] [WordPress Trac] #7219: the_media_upload_tabs() always shows first tab as active

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 1 21:43:54 GMT 2008


#7219: the_media_upload_tabs() always shows first tab as active
---------------------+------------------------------------------------------
 Reporter:  fuggi    |       Owner:  anonymous 
     Type:  defect   |      Status:  new       
 Priority:  normal   |   Milestone:            
Component:  General  |     Version:  2.5.1     
 Severity:  major    |    Keywords:  MEdia Tabs
---------------------+------------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7219>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list