BuddyDev

Search

Warning when displaying group page

  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6124

    There is a new warning since last update when displaying a group page: http://imgur.com/a/EWW7r

    The admin and moderator thumbs generate this warning.

    This didn’t show up before the update.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #6167

    Hi Jaume,
    Any chance that you are using a caching solution? Try flushing them.
    Also, which version of PHP are you using?

  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6206

    Hi Brajesh. I’ve been busy. Sorry for the delay.

    Caching is OK. Flushed from server but still having the same problem.

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

    The message is: Warning: Creating default object from empty value in XXX/wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php on line 1122

    This is the function on line 1122:

    /**
    * 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;
    }

    /*************/

    Is this $group_mods new? How do I get rid of that warning? What has changed in this last update? I got the admin list but not a message saying there were no mods so, something has changed in the code.

  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6207

    1.- I have hidden the waring using -> error_reporting(E_ERROR | E_PARSE); before the offending line. Temporary solution, but solution.

    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.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #6220

    Hi Jaume,
    I am sorry but I am not able to recreate it. Please try putting WP_DEBUG on and see what else you can find.

  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6228
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6229
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 40
    Jaume Aragay on #6230
    This reply has been marked as private.

You must be logged in to reply to this topic.

This topic is: not resolved