Skip to:
Content

bbPress.org

Opened 4 months ago

Last modified 4 months ago

#3426 assigned defect

Fatal error: Uncaught Error: Class 'BBP_BuddyPress_Activity' not found

Reported by: jasonrush Owned by: johnjamesjacoby
Milestone: Under Consideration Priority: normal
Severity: normal Version: 2.6.6
Component: Extend - BuddyPress Keywords: reporter-feedback
Cc:

Description (last modified by johnjamesjacoby)

WordPress version: 5.7
bbPress Version 2.6.6

Client wanted to disable the activity stream, went to Dashboard > Settings > BuddyPress > Components > Activity Streams and Unticked the option. When he hit save it said There has been a critical error on this website and the entire website (including admin dashboard) was unreachable/unusable (only returning this error).

After enabling debugging info, I received the following error (paths sanitized for security):

Fatal error: Uncaught Error: Class 'BBP_BuddyPress_Activity' not found in public_html/wp-content/plugins/bbpress/includes/extend/buddypress/loader.php:153 Stack trace:
#0 public_html/wp-includes/class-wp-hook.php(292): BBP_Forums_Component->setup_components('')
#1 public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
#2 public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
#3 public_html/wp-content/plugins/buddypress/bp-core/bp-core-dependency.php(267): do_action('bp_init')
#4 public_html/wp-includes/class-wp-hook.php(292): bp_init('')
#5 public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
#6 public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
#7 public_html/wp-settings.php(560): do_action('init')
#8 public_html/wp-co in public_html/wp-content/plugins/bbpress/includes/extend/buddypress/loader.php on line 153

I was able to temporarily resolve the issue by patching the following function (wp-content/plugins/bbpress/includes/extend/buddypress/loader.php):

Line 153 being the "new BBP_BuddyPress_Activity()" line.

        /**
         * Instantiate classes for BuddyPress integration
         *
         * @since 2.0.0 bbPress (r3395)
         */
        public function setup_components() {

                // Always load the members component
                bbpress()->extend->buddypress->members = new BBP_BuddyPress_Members();

                // Create new activity class
                if ( bp_is_active( 'activity' ) ) {
                        bbpress()->extend->buddypress->activity = new BBP_BuddyPress_Activity();
                }

                // Register the group extension only if groups are active
                if ( bbp_is_group_forums_active() && bp_is_active( 'groups' ) ) {
                        bp_register_group_extension( 'BBP_Forums_Group_Extension' );
                }
        }

Patched code:

                // Create new activity class
                if ( bp_is_active( 'activity' ) ) {
// Temporary patch!
if ( ! class_exists( 'BBP_BuddyPress_Activity' ) ){
require_once(dirname(__FILE__).'/activity.php');
}
                        bbpress()->extend->buddypress->activity = new BBP_BuddyPress_Activity();
                }

Let me know if there's any additional information that would be helpful.

Change History (3)

#2 @johnjamesjacoby
4 months ago

  • Description modified (diff)

#3 @johnjamesjacoby
4 months ago

  • Component changed from Component - Any/All to Extend - BuddyPress
  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to Under Consideration
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

Hey @jasonrush thanks for creating this ticket. I've corrected the formatting and deleted your correction comment, just to keep everything tidy.

Your recommended code change will prevent the error from making it to the screen, but I think correcting the error needs to happen earlier to make sure the file is always loaded when it needs to be.

What version of BuddyPress are you using, and how do you have it activated (single-site, multi-site, network active, etc...)

I wasn't able to replicate on single-site. I don't have a multisite install to test with right now, but I can set one up soon.

The error message you're seeing technically shouldn't be possible.

  • bbp_setup_buddypress is hooked to bp_include like BuddyPress components are
  • BBP_Forums_Component::includes() uses bp_is_active( 'activity' )
  • BBP_Forums_Component::setup_components() uses bp_is_active( 'activity' )

The only thing I can imagine is some kind of race condition with updating the buddypress()->active_components array, maybe related to a cache invalidation, or a broken redirect.

Thank you again, and talk soon!

#4 @jasonrush
4 months ago

@johnjamesjacoby

I figured this was probably not the best way to patch, but had to find an immediate solution to the issue for the live site and figured I'd pass it along as an added data point. I'm all for finding the proper solution. This site is on a single-site instance of WordPress. It's definitely possible it could be a race condition (there are several BuddyPress related plugins installed), but I believe I did clear cache in troubleshooting so while I'm not certain I'm doubting it's a caching issue. As for a broken redirect, as it seems to be a PHP include issue, I'm not sure how that would involve redirects, though I'm not particularly familiar with the BuddyPress or bbPress codebases.


Installed plugins and versions

amr shortcode any widget
Version 3.7 | By anmari | View details

bbPNNS/BuddyPress Bridge
Version 1.8.1 | By Vinny Alves (UseStrict Consulting) | View details

bbPress
Version 2.6.6 | By The bbPress Contributors | View details

bbPress Notify (No-Spam)
Version 2.15.2 | By Vinny Alves (UseStrict Consulting) | View details

bbPress Notify (No-Spam) Digests
Version 2.2.1 | By Vinny Alves (UseStrict Consulting) | View details

bbPress Notify (No-Spam) Reply by Email
Version 2.3.1 | By Vinny Alves (UseStrict Consulting)

BuddyBoss Products Updater
Version 1.2.8 | By BuddyBoss | Visit plugin site

BuddyBoss Wall
Version 1.3.8 | By BuddyBoss | Visit plugin site

BuddyPress
Version 7.2.1 | By The BuddyPress Community | View details

BuddyPress Docs
Version 2.1.5 | By Boone B Gorges, David Cavins | View details

BuddyPress Global Search
Version 1.2.1 | By BuddyBoss | View details

BuddyPress Group Tabs Creator Pro
Version 1.0.9 | By BuddyDev | Visit plugin site

BuddyPress User Profile Tabs Creator Pro
Version 1.1.9 | By BuddyDev | Visit plugin site

CB Change Mail Sender
Version 1.2.2 | By Md Abul Bashar | View details

Classic Editor
Version 1.6 | By WordPress Contributors | View details

Custom Sidebars
Version 3.31 | By WebFactory Ltd | View details

CyberSEO Lite (CyberSyn)
Version 6.31 | By CyberSEO.net | View details

Email posts to subscribers
Version 5.7 | By Gopi Ramasamy | View details

FormLift
Version 7.5.14.3 | By Adrian Tobey | View details

GD bbPress Attachments
Version 4.2 | By Milan Petrovic | View details | Upgrade to GD bbPress Toolbox Pro

GEO my WP
Version 3.7.0.1 | By Eyal Fitoussi | View details

GMW Add-on - BP Xprofile Geolocation
Version 1.6.0.1 | By Eyal Fitoussi | Visit plugin site

GP Copy Cat
Version 1.4.38 | By Gravity Wiz | Visit plugin site

GP Multi-page Navigation
Version 1.0.10 | By Gravity Wiz | Visit plugin site

GP Preview Submission
Version 1.3.3 | By Gravity Wiz | Visit plugin site

Gravity Forms
Version 2.4.23 | By Gravity Forms | View details

Gravity Forms Tooltips
Version 2.0 | By Sushil Kumar | Visit plugin site

Gravity Perks
Version 2.2.2 | By Gravity Wiz | Visit plugin site

i2SDK
Version 3.99 | By David Bullock | Visit plugin site | Check for updates

Instagram Feed Pro Developer
Version 5.12 | By Smash Balloon | Visit plugin site

Jason Rush - Monitoring/Management
Version 4.9.8 | By Jason Rush | Connection Management

LearnDash LMS
Version 3.3.0.3 | By LearnDash | Visit plugin site | Changelog

Memberium
Version 2.155 | By David Bullock | Visit plugin site

Page Builder by SiteOrigin
Version 2.11.8 | By SiteOrigin | View details

Real-Time Find and Replace Pro
Version 4.0.3 | By Marios Alexandrou | Visit plugin site | Settings

Really Simple SSL
Version 4.0.13 | By Really Simple Plugins | View details

Redirection
Version 5.0.1 | By John Godley | View details

Simple Calendar
Version 3.1.35 | By Simple Calendar | View details | Add-ons

Styles & Layouts Gravity Forms
Version 4.3 | By Sushil Kumar | View details

WordPress Importer
Version 0.7 | By wordpressdotorg | View details

WP Super Cache
Version 1.7.2 | By Automattic | View details

Note: See TracTickets for help on using tickets.