Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group header file problems


  • jaumearagay
    Participant

    @jaumearagay

    Hi there!

    2 problems with group header file after 2.7.0. update (and cleaning cache in server and in browser and re-logging in).

    These are the versions I use:
    WordPress Version: 4.6.1
    PHP Version: 5.6.27
    MySQL Version: 5.6.28

    1.- I have a warning that I didn’t have before: “Warning: Creating default object from empty value in /home/…/wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php on line 1122”. I’ve hidden the warning but it’s not a solution.

    This is the function on line 1122 of that file:

    /**
    * Get a list of all a given group’s moderators.
    *
    * @since 1.6.0
    *
    * @param int $group_id ID of the group.
    * @return array Info about group mods (user_id + date_modified).
    */
    public static function get_group_moderator_ids( $group_id ) {
    global $wpdb;
    
    $group_mods = wp_cache_get( $group_id, ‘bp_group_mods’ );
    
    if ( false === $group_mods ) {
    self::prime_group_admins_mods_cache( array( $group_id ) );
    $group_mods = wp_cache_get( $group_id, ‘bp_group_mods’ );
    }
    
    // Integer casting.
    foreach ( (array) $group_mods as $key => $data ) {
    $group_mods[ $key ]->user_id = (int) $group_mods[ $key ]->user_id;
    }
    
    return $group_mods;
    }
    
    /*************/

    2.- The problem is somewhere else: In line 33 of the group-header.php file (in groups/single/ ) we find this line:

    if ( bp_group_has_moderators() ) :

    where “bp_group_has_moderators()” is giving a false “true” value as I don’t have moderators in any group but the code is executed saying “there are no moderators” so it should not execute in the first place.

    I added this code to the file:

    /* TMP ************************************************** */
    echo “moderators: <br/>”;
    $tt = bp_group_has_moderators();
    
    echo “<pre>";
    var_dump( $tt );
    echo "</pre>“;
    
    /* *************** */

    And this is the result:

    array(1) {
    [0]=>
    object(stdClass)#5165 (1) {
    [“user_id”]=>
    int(0)
    }
    }

    Does it bring any light?

Viewing 19 replies - 26 through 44 (of 44 total)
  • We’re closing in on the problem, I think. One more debug addition, this time to bp-core/bp-core-cache.php:
    http://pastie.org/10965063#12-14

    Thanks!


    jaumearagay
    Participant

    @jaumearagay

    ADDITION means I leave the tweaked files in place and ADD this one? 😉

    You can remove the other statements if you want. We know what they’re doing. 🙂


    jaumearagay
    Participant

    @jaumearagay

    In the group page you get this output:

    int(91) string(21) "bp_groups_memberships" object(stdClass)#5452 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5465 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5465 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5465 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5751 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5753 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(91) string(21) "bp_groups_memberships" object(stdClass)#5753 (12) { ["id"]=> string(2) "91" ["group_id"]=> string(2) "13" ["user_id"]=> string(1) "6" ["inviter_id"]=> string(1) "0" ["is_admin"]=> string(1) "0" ["is_mod"]=> string(1) "0" ["user_title"]=> string(0) "" ["date_modified"]=> string(19) "2016-09-15 11:37:10" ["comments"]=> string(0) "" ["is_confirmed"]=> string(1) "0" ["is_banned"]=> string(1) "0" ["invite_sent"]=> string(1) "0" } int(6) string(22) "bp_friends_friendships" object(stdClass)#5774 (6) { ["id"]=> string(1) "6" ["initiator_user_id"]=> string(1) "6" ["friend_user_id"]=> string(2) "36" ["is_confirmed"]=> string(1) "1" ["is_limited"]=> string(1) "0" ["date_created"]=> string(19) "2016-09-06 09:22:58" } int(1) string(22) "bp_friends_friendships" object(stdClass)#5775 (6) { ["id"]=> string(1) "1" ["initiator_user_id"]=> string(1) "6" ["friend_user_id"]=> string(1) "5" ["is_confirmed"]=> string(1) "1" ["is_limited"]=> string(1) "0" ["date_created"]=> string(19) "2016-08-22 10:25:37" } int(6) string(16) "bp_last_activity" array(3) { ["user_id"]=> string(1) "6" ["date_recorded"]=> string(19) "2016-11-18 20:15:56" ["activity_id"]=> string(1) "1" }


    jaumearagay
    Participant

    @jaumearagay

    I’ve left the other file’s modified version active.


    jaumearagay
    Participant

    @jaumearagay

    And this is what we get at the groups’ listing page before the first group:

    http://pastie.org/10965263

    I’ve tried to paste it directly here but the forum does not allow me to do it. Sorry for the long-line format! 😉

    OK, maybe I could have administrator access to your site temporarily (or FTP access, whichever is easier for you)? You can find me on the buddypress channel in Slack, or email me at d_cavins76 [at] yahoo [dot] com.


    jaumearagay
    Participant

    @jaumearagay

    And your nick in the channel? I can’t find you there…


    jaumearagay
    Participant

    @jaumearagay

    My fault! I misspelled your name! I found you there! 😉


    JeffWillia.ms
    Participant

    @jeffwilliams-1

    Hello All!

    Some interesting news with this. Per suggestions in other forums (i.e. Buddy-Trac, etc.), they thought the issue might be related to my host’s caching, so I wrote Site Ground Support and asked them to check into the problem. Her reply is below:

    “I was able to load the page in Mozilla and Safari with no resolving errors. However, once I opened it with Google Chrome, the error appear. I have cleared the application cache and deactivated plugins, however, to no avail. The issue is not server related it is an issue with the code”

    After receiving her reply, I went and tested her findings for myself. Indeed, she was right. However, the investigation with different browsers must have caused a “break thru” with Chrome, because it no longer shows the error. This is true for multiple sites I manage that had the same issue.

    Not sure why that solved the problem, but thought I’d let you guys know about it.

    Thanks for taking the time to help.

    Cheers.


    alexdex
    Participant

    @alexdex

    Hi, sorry i have the same problem, i try to fix without success
    Somebody can give me the solution?
    Thanks a lot


    jmichaelp
    Participant

    @jmichaelp

    Has anyone made progress or presented a workable solution for this?
    Having the same issue myself, all software at current versions.

    Hi @jmichaelp

    No, we’ve not solved it, because most of us can’t recreate the issue. If you are comfortable doing some troubleshooting, please run the various var_dumps and tracing code I’ve added further on up in this thread and let me know what you find. Or, grant me administrator access to your site via FTP for a short time when I’m able to dig into it myself.

    Thanks! We’d love to have access to a broken site to see what’s up.

    -David


    mln83
    Participant

    @mln83

    Same problem on my site. Running theme Boss 2.3 from BuddyBoss.

    Please write PM if you need access to a broken site.

    Best regards,
    Michael


    lawlyet
    Participant

    @lawlyet

    This error is showing up to many websites. A google search for “PHP Warning: Creating default object from empty value in /wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php on line 1170” returns almost 5500 results…

    And if you search for “PHP Warning: Creating default object from empty value in class-bp-groups-member.php on line” (removing line number and the path of the file from the results, you get some something like 337000 results.

    My site is also showing this message, and I already removed all plugins and themes, running the latest version of WP, BP and BBPress with Twenty Seventeen template.

    I guess it may be a problem with php, or maybe with chrome and chromium… Maybe it is time to start working on this issue.

    I already added the following in my functions.php:

    /* Remove errors if any */
    error_reporting(E_ERROR | E_PARSE);
    /* End remove Errors */

    it’s not the ideal. there is also the better option to add some lines in your wp-config.php, to do a proper debug and get it in a log file, instead of showing it in the site.

    Hi @lawlyet

    If you’re up for helping to root out this problem, please add this debugging info as mentioned above:

    We’re closing in on the problem, I think. One more debug addition, this time to bp-core/bp-core-cache.php:
    http://pastie.org/10965063#12-14

    Pastie is broken at the moment, but hopefully it’ll be back up soon.

    Thanks for you help with this!

    -David


    janikaconcon
    Participant

    @janikaconcon

    has someone have answered this problem already??? i have the same error.

    i just add this to my function.php for temporary solution.

    /* Remove errors if any */
    error_reporting(E_ERROR | E_PARSE);
    /* End remove Errors */


    milesnext
    Participant

    @milesnext

    Same problem here.
    I use the code suggested above. However, the code conflict to another plugin Paid Membership Pro. ><
    It will not allow discount code entering in Paid Membership Pro.

    I think I finally understand what is going wrong here. If you pass a bad group object to bp_group_has_moderators() or don’t pass a group object and the global $groups_template->group isn’t set, this error can occur.

    If you’ve had this problem, can you please respond telling me what theme you’re using? Furthermore, look in your theme where bp_group_has_moderators() is called, and tell me if it’s being called with a $group argument (like bp_group_has_moderators( $group_object ) ) or without an argument (like bp_group_has_moderators() ).

    Do you also see an entry in your error log like the following or not?
    Trying to get property of non-object in /Users/dcavins/Sites/develop.git.wordpress.org/src/wp-content/plugins/buddypress/src/bp-groups/bp-groups-template.php on line 2576

    Thanks for your help,

    -David

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