Skip to:
Content
Pages
Categories
Search
Top
Bottom

Fatal error on a BuddyPress 2.6.0 upgrade


  • Jason75
    Participant

    @jason75

    Hello – I have the latest WordPress version installed along with the latest Woffice theme update. However when I update buddypress to the latest version 2.6.0 the whole site breaks and this error appears:

    Fatal error: Call to undefined function bp_get_current_group_id() in /home/.../public_html/.../wp-content/plugins/buddypress/bp-groups/classes/class-bp-group-extension.php on line 484

    Any thoughts?
    I’am able to get the site working again, when I restore to a saved backup…
    Thanks

Viewing 18 replies - 1 through 18 (of 18 total)
  • Is this error appearing on all pages of a site (on front-end) or only in admin area where you are upgrading?
    Woffice is a premium theme from themeforest, so we can’t test that. The issue might be in the way hooks are used in a theme, so you might want to contact them.


    syborg
    Participant

    @syborg

    Hello, I had exactly the same problem, with the theme “KLEO” (seventhqueen).

    If it can helps someone, the problem was caused by the plugin “Buddypress Cover Photo”. I fixed it by changing the first line in the file /plugins/buddypress-cover-photo/group-cover.php :

    if ( class_exists( 'BP_Group_Extension' ) ) :

    by

    if ( class_exists( 'BP_Group_Extension' ) && bp_is_active('groups') ) :

    (It’s my first post on this forum, so I wanted to say that Buddypress is a great plugin, good work guys !)

    Thanks for sharing, @syborg!


    @jason75
    ,
    Could you please test the solution above with your theme?

    Also, @jason75 and @syborg – as you are owners of that Kleo theme, could you please contact Kleo authors with this thread information? They should test their theme with the latest BuddyPress 2.6.


    r-a-y
    Keymaster

    @r-a-y

    Hmm, it looks like class autoloading is causing this trouble.

    I’ll try to duplicate this locally.


    syborg
    Participant

    @syborg

    I posted a topic on the Buddypress Cover Photo support forum, on wordpress.org. (Same authors as KLEO theme and support forum so easier to access). Bye !


    r-a-y
    Keymaster

    @r-a-y

    Can somebody try this patch in bp-loader.php?

    https://gist.github.com/r-a-y/f54e7a07b71af1c7bfab6e06433da3d6


    kaab321
    Participant

    @kaab321

    This helped me A LOT! Solved my error. Got it from:

    https://wordpress.org/support/topic/fatal-error-with-buddypress-26?replies=3#post-8563337

    Open Quote:

    If you’re like me and have buddypress groups turned off, this will produce the error shown. I fixed by adding this to

    /wp-content/plugins/buddypress/bp-groups/classes/class-bp-group-extension.php

    change:

    $group_id = bp_get_current_group_id();

    to:

    $group_id = (bp_is_active('groups') ? bp_get_current_group_id() : '');

    and change:

    if ( empty( $group_id ) && bp_get_new_group_id() ) {
        $group_id = bp_get_new_group_id();
    }

    to:

    if(bp_is_active('groups')) {
        if ( empty( $group_id ) && bp_get_new_group_id() ) {
            $group_id = bp_get_new_group_id();
        }
    }

    IMO, they should have tested this before pushing out an update. Hopefully they figure things out.

    Close quote


    pandabear
    Participant

    @pandabear

    I am getting a fatal error after upgrade to BP 2.6.0 as well. Upgraded to WP 4.5.3 yesterday, then BP 2.6.0 today. WP_Debug reports ‘Call to undefined function bp_loggedin_user_id()’ in my custom child theme (Canvas parent theme) functions.php file. I tried the patch on bp-loader.php, r-a-y, but that was a no go for me. This is wiping out all front and back-end display on my local server. Fortunately, production is running WP 4.5.3 with BP 2.5.3, which is running fine. Still trying to debug…


    pandabear
    Participant

    @pandabear

    My particular problem was with the (ancient, but useful) plugin bp-group-hierarchy. The manual fix recommended in the post BuddyPress 2.6.0 “Espejo” is now available (found here: https://github.com/ddean4040/BP-Group-Hierarchy/pull/21/files) got me back up and running. Thanks!


    Jason75
    Participant

    @jason75

    Thank you kaab321. Applied your suggested updates and the site is back online… Thanks again


    syborg
    Participant

    @syborg

    @kaab321 I think that the fix proposed by @r-a-y is more elegant and relevant. You should use it instead, if it works for you, of course.

    Thank you @r-a-y, I tried it and it works for me 🙂
    I’ve seen that it was an autoload problem, but my knowledge about the buddypress core is very limited :/ I preferred modify a plugin than dare to change directly a buddypress file.


    Antonio
    Participant

    @anth0ny167

    Hi, I am one of the guys behind Woffice. On Woffice seems that the problem is not a conflict with “Buddypress Cover Photo”, the issue happens also without the plugin if the component “groups” is disabled.

    So the solution proposed by @r-a-y doesn’t work for us, instead the solution proposed by @kaab321 solved the issue.


    r-a-y
    Keymaster

    @r-a-y

    @anth0ny167 or anyone else experiencing this problem, I’m convinced this is a problem with class autoloading that we introduced in BuddyPress 2.6.

    Although it helps, you shouldn’t need to add bp_is_active() checks that kaab321 recommended, the fact that you do means that it is a bug with BuddyPress.

    If you can duplicate your issue after using my proposed fix:
    https://gist.github.com/r-a-y/f54e7a07b71af1c7bfab6e06433da3d6

    Then, please let me know the steps on how I could replicate this on a fresh install if possible.


    @syborg
    has verified that this works.

    Also, the BP Group Hierarchy issue is not related to this one.


    r-a-y
    Keymaster

    @r-a-y

    I’ve duplicated the issue for plugins using code like this:

    add_action( 'bp_include', function() {
            if ( class_exists( 'BP_Group_Extension' ) ) {
                    class My_Group_Extension extends BP_Group_Extension {
                    }
    
                    bp_register_group_extension( 'My_Group_Extension' );
            }
    }, 99 );

    The BuddyPress Cover Photo plugin uses something similar to the above.

    I’ve opened a ticket with a fix to this specific problem:
    https://buddypress.trac.wordpress.org/ticket/7140


    SeventhQueen
    Participant

    @seventhqueen

    Thanks for pointing the issue on our BuddyPress Cover Photo plugin. The update will be available in a few minutes.

    Cheers


    r-a-y
    Keymaster

    @r-a-y

    @seventhqueen – Thanks for updating your plugin!


    rintusibi
    Participant

    @rintusibi

    Hi,
    I have the same problem like “Fatal error: Call to undefined function bp_get_current_group_id() in /home/…/public_html/…/wp-content/plugins/buddypress/bp-groups/classes/class-bp-group-extension.php on line 484”. The solution given above can fixed the issue, but it is affecting when i am updating the plugin. So, how can i override this file inside the theme so that the change wont lose when i update the plugin buddypress.


    r-a-y
    Keymaster

    @r-a-y

    @rintusibi – If you’re referring to this fix:
    https://buddypress.trac.wordpress.org/attachment/ticket/7140/7140.01.patch

    This will be part of BuddyPress 2.6.1.

Viewing 18 replies - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.
Skip to toolbar