Skip to:
Content

BuddyPress.org

Changeset 13229


Ignore:
Timestamp:
02/04/2022 04:55:37 AM (3 years ago)
Author:
imath
Message:

Carry on loading a legacy widget if it's active in a sidebar

Props r-a-y, vapvarun

Fixes #8625 (branch 10.0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/10.0/src/bp-core/bp-core-widgets.php

    r13153 r13229  
    7070
    7171    $callbacks = array(
    72         'bp_core_register_login_widget',
    73         'bp_members_register_members_widget',
    74         'bp_members_register_whos_online_widget',
    75         'bp_members_register_recently_active_widget',
     72        'BP_Core_Login_Widget'           => 'bp_core_register_login_widget',
     73        'BP_Core_Members_Widget'         => 'bp_members_register_members_widget',
     74        'BP_Core_Whos_Online_Widget'     => 'bp_members_register_whos_online_widget',
     75        'BP_Core_Recently_Active_Widget' => 'bp_members_register_recently_active_widget',
    7676    );
    7777
    7878    if ( bp_is_active( 'friends' ) ) {
    79         $callbacks[] = 'bp_friends_register_friends_widget';
     79        $callbacks['BP_Core_Friends_Widget'] = 'bp_friends_register_friends_widget';
    8080    }
    8181
    8282    if ( bp_is_active( 'groups' ) ) {
    83         $callbacks[] = 'bp_groups_register_groups_widget';
     83        $callbacks['BP_Groups_Widget'] = 'bp_groups_register_groups_widget';
    8484    }
    8585
    8686    if ( bp_is_active( 'messages' ) ) {
    87         $callbacks[] = 'bp_messages_register_sitewide_notices_widget';
     87        $callbacks['BP_Messages_Sitewide_Notices_Widget'] = 'bp_messages_register_sitewide_notices_widget';
    8888    }
    8989
    9090    if ( bp_is_active( 'blogs' ) && bp_is_active( 'activity' ) && bp_is_root_blog() ) {
    91         $callbacks[] = 'bp_blogs_register_recent_posts_widget';
     91        $callbacks['BP_Blogs_Recent_Posts_Widget'] = 'bp_blogs_register_recent_posts_widget';
    9292    }
    9393
    94     foreach ( $callbacks as $callback ) {
     94    foreach ( $callbacks as $widget_id => $callback ) {
     95        $widget_base = strtolower( $widget_id );
     96
     97        // If there's an active widget, we need to carry on loading it.
     98        if ( is_active_widget( false, false, $widget_base ) ) {
     99            continue;
     100        }
     101
    95102        remove_action( 'widgets_init', $callback );
    96103    }
Note: See TracChangeset for help on using the changeset viewer.