Make WordPress Core

Changeset 7080


Ignore:
Timestamp:
02/28/2008 12:31:46 AM (19 years ago)
Author:
ryan
Message:

Fix widgets using old-style multi instance support. Props mdawaffe. fixes #6023

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/widgets.php

    r6980 r7080  
    4242                        }
    4343
    44                         $sidebar = is_active_widget( $widget['callback'] );
     44                        $sidebar = is_active_widget( $widget['callback'], $widget['id'] );
     45
    4546                        if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
    4647                                continue;
     
    5152                        ob_end_clean();
    5253
    53                         if ( !$sidebar || false !== strpos( $widget_control_template, '%i%' ) ) {
    54                                 $already_shown[] = $widget['callback']; // it's a multi-widget.  We only need to show it in the list once.
     54                        if ( !$sidebar || $is_multi = false !== strpos( $widget_control_template, '%i%' ) ) {
     55                                if ( $is_multi )
     56                                        $already_shown[] = $widget['callback']; // it's a multi-widget.  We only need to show it in the list once.
    5557                                $action = 'add';
    5658                                $add_url = wp_nonce_url( add_query_arg( array(
  • trunk/wp-includes/widgets.php

    r7077 r7080  
    253253/* @return mixed false if widget is not active or id of sidebar in which the widget is active
    254254 */
    255 function is_active_widget($callback) {
     255function is_active_widget($callback, $widget_id = false) {
    256256        global $wp_registered_widgets;
    257257
     
    261261                if ( is_array($widgets) ) foreach ( $widgets as $widget )
    262262                        if ( isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback )
    263                                 return $sidebar;
     263                                if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
     264                                        return $sidebar;
     265                               
    264266
    265267        return false;
Note: See TracChangeset for help on using the changeset viewer.