[wp-trac] [WordPress Trac] #10956: replacement is_active_sidebar - wp-includes/widgets.php

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 9 00:41:57 UTC 2009


#10956: replacement is_active_sidebar - wp-includes/widgets.php
-------------------------+--------------------------------------------------
 Reporter:  Frumph       |       Owner:           
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.9      
Component:  General      |     Version:  2.9      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------

Comment(by CharlesClarkson):

 The patched function fails if a lower numbered sidebar is unregistered
 (unregister_sidebar()) than the one be searched for. In my test case I
 tried to test sidebar-5 by the sidebar name (Sidebar Top) after having
 removed sidebar-2. This version of the function has no way to "know" that
 an array key was unset and in a 5 sidebar theme (with 1 removed) it never
 tests for sidebar-5 because $i never gets that high.

 {{{
 register_sidebar(array('name'=>'Sidebar Bottom Left',));
 register_sidebar(array('name'=>'Sidebar Bottom Right',));
 register_sidebar(array('name'=>'468x60 Header Banner',));
 register_sidebar(array('name'=>'468x60 Post Banner',));
 register_sidebar(array('name'=>'Sidebar Top',));
 unregister_sidebar('sidebar-2');
 }}}

 This function also fails if the sidebar was registered with a different id
 from the default:
 {{{
 register_sidebar(array('name'=>'Sidebar Top','id'=>'top-sidebar'));
 }}}

 Without an internal id that cannot be changed by users, checking a sidebar
 by an integer ( is_active_sidebar(1) ) is not guaranteed to work.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10956#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list