Skip to:
Content

BuddyPress.org

Ticket #8625: 8625-03.patch

File 8625-03.patch, 1.9 KB (added by imath, 2 years ago)
  • src/bp-core/bp-core-widgets.php

    diff --git src/bp-core/bp-core-widgets.php src/bp-core/bp-core-widgets.php
    index 53ae6d981..48836116c 100644
    function bp_core_maybe_unhook_legacy_widgets() { 
    6969        }
    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        }
    97104}