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 25 replies - 1 through 25 (of 44 total)

  • jaumearagay
    Participant

    @jaumearagay

    Does anyone have the same problem or do I have a fight between plugins goin on? 😉


    manueldo
    Participant

    @manueldo

    I have the same error. What theme are you using? I am using Kleo.


    danbp
    Participant

    @danbp

    @manueldo, which bp version do you use ?


    manueldo
    Participant

    @manueldo

    Hi @danbp, my bp version is 2.7.2


    danbp
    Participant

    @danbp

    Well, you now have to control your child theme and custom functions (if any).
    Seems that changes made in BP 2.7, 2.7.1 and 2.7.2 won’t apply to your case.

    Read also here.

    And if it doesn’t help, go to kleo support and ask there.


    manueldo
    Participant

    @manueldo

    Thanks @danbp, I will try to fix it.


    jaumearagay
    Participant

    @jaumearagay

    @manueldo, I’m using a child theme for Canvas from Woo.
    I’m so busy this week with something else… I’ll update to 2.7.2. probably on the weekend. I’ll keep you posted! 😉


    manueldo
    Participant

    @manueldo

    Thanks @jaumearagay! I´ll do the same.


    padykule
    Participant

    @pauldyke

    Hiya. I too have this error since updating to 2.7.2. We haven’t made any other changes in a while. It appears on each group page. I’m running Sweetdate theme also by seventhqueen. The error appears on the master theme preview, not just the active child theme.


    danbp
    Participant

    @danbp

    @pauldyke,

    did you check your templates ? Have you tried to use 2016, to ensure that it is/or not a theme issue ?
    If it appears to be a theme issue, you have to contact seventhqueen, as we can’t assist you for premium themes.


    jaumearagay
    Participant

    @jaumearagay

    I have:

    a.- Updated to BP 2.7.2. <– Still same problems but warnings hidden by my code.

    b.- Removed the buddypress folder in my theme with edited files and checked. <– Still same problems: Warnings (as my code did not hide them), “Moderators” tag and “no mods” string.

    c.- Downloaded and activated Twenty Sixteen theme. <– Same as in previous step.

    And I get the same warning explained in the first entry in this post so it’s not about my modified files and it’s not about a theme problem.

    There are still two problems:

    1.- The warning points to get_group_moderator_ids( $group_id ) in /wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php

    I don’t have (or have had) moderators in any group so, “Creating default object from empty value” <– What default object from what empty value?

    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 so it should not execute in the first place. And after the Moderators tag it says “no mods”, so it on a later step recognizes there are no moderators!!!

    Has the bp_group_has_moderators() function or get_group_moderator_ids( $group_id ) function been altered? Or the data about mods and/or admins in the groups?

    Because one of them creates two warnings (one before listing the admins and one before listing the mods) that were not there before and also shows a “Moderators” tag that did not appear as the if ( bp_group_has_moderators() ) returned the FALSE value my no-mods groups “deserve” (which it later recognizes when adding the “no mods” string) that now returns this “buggy” TRUE value and shows the tag.


    manueldo
    Participant

    @manueldo

    I asked seventhqueen for help and they said the problem is from buddypress, they can not help.

    When you have a private group and go to approve some member the warning is showed but after approving, when the page reload saying that the membership was approved, the warning dissapears, is the only page where the warning is not being showed.


    David Cavins
    Keymaster

    @dcavins

    Hi @jaumearagay-

    Unhappily, I’m not able to reproduce your problem on my servers. Can you test something for me in your environment where we know the problem exists? I’d like to know what the value of $group_mods is before it’s passed to the foreach in get_group_moderator_ids().

    I’ve added a var_dump() in this snippet: http://pastie.org/10962912

    Please let me know what you find.

    Thanks!

    -David


    JeffWillia.ms
    Participant

    @jeffwilliams-1

    Details:

    Theme: Kleo (Parent and Child) Latest version
    WP: Latest Version
    BP: Latest Version

    Having the same issue and have reported it in Buddypress Trac, Buddypress Support forums (here) and discussed it at length with Seventh Queen (theme developer).

    Tried it with all themes…parent, child, and default 2016. Problems exist in all themes

    Turned off all plugins. Problem persists regardless.

    Cleaned all caches, including host, and Cloudflare.

    Can’t seem to find a solution. Any ideas?

    Thanks.


    David Cavins
    Keymaster

    @dcavins

    HI @JeffWillia.ms-

    Can you do the troubleshooting step requested above?

    Thanks,

    -David


    JeffWillia.ms
    Participant

    @jeffwilliams-1

    Hi @dcavins

    Sure thing. I copied and added the code from the Pastie link you provided, to the directory you specified.

    Anything you need me to do to follow up?

    Thanks!


    JeffWillia.ms
    Participant

    @jeffwilliams-1

    Hi @dcavins

    Following up after my last reply. I added your code to the specified directory. I receive this error in all my Buddypress interfaces (i.e. members, forums, etc.)

    Parse error: syntax error, unexpected ‘<‘ in /home/swiftbus/public_html/5firemen.com/wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php on line 1314

    I just get a white screen with that error in it.

    After deleting your code from the file directory above, the problem went away.

    However, the original Groups Header issue still persists.

    Hope that helps! 🙂


    jaumearagay
    Participant

    @jaumearagay

    Hi @dcavins! 🙂

    I get this, see the image attached, but this is the summary: it gets called twice and the result is bool(false).

    http://imgur.com/a/tDmBr <– the screen capture in a group display page.

    Thanks! 😉


    David Cavins
    Keymaster

    @dcavins

    Hi @jaumearagay & @JeffWillia.ms-

    Thanks for posting the results of your testing. @jaumearagay, your results match what I expected. Can you try another test for me that checks the value after the foreach?
    http://pastie.org/10964506

    Thanks for your patience as we figure this one out.

    -David


    JeffWillia.ms
    Participant

    @jeffwilliams-1

    @dcavins

    Last request only for @jaumearagay?

    Thanks.


    David Cavins
    Keymaster

    @dcavins

    @jeffwilliams-1 Not at all! If you’re feeling like chasing it down, give it a try. When your code change last time failed, it was probably because somewhere along the line, a < was encoded for the web as

    & l t ;

    so make sure that the changes to the file look visually like <?php

    Thanks!


    jaumearagay
    Participant

    @jaumearagay

    The code pasted from the page:

    Administradores de grupo
     $group_mods before foreach: bool(false)
     $group_mods after foreach: array(1) {
      [0]=>
      object(stdClass)#5830 (1) {
        ["user_id"]=>
        int(0)
      }
    }
    [Here is the admin picture in the page]
     $group_mods before foreach: bool(false)
     $group_mods after foreach: array(1) {
      [0]=>
      object(stdClass)#5876 (1) {
        ["user_id"]=>
        int(0)
      }
    }
    Moderadores del Grupo
    Sin mods

    And the screen capture: http://imgur.com/a/E6R76


    David Cavins
    Keymaster

    @dcavins

    Thanks again for your help troubleshooting. Can you add a couple of debug statements to the function prime_group_admins_mods_cache() in the same class? It looks like the cache item bp_group_mods is not being set properly; I’m trying to understand why that would be.

    Debug lines added here:
    http://pastie.org/10965044#11,35

    Thanks!


    jaumearagay
    Participant

    @jaumearagay

    I can do it, for sure… But would you prefer an admin user to dive in it? The site is actually not open to the public, so we can tweak to our wish…

    I’ll do this step you ask me to but if you’d better check it yourself, just ask! 😉


    jaumearagay
    Participant

    @jaumearagay

    The code:

    Administradores de grupo
     $uncached group_ids: array(0) {
    }
     $group_mods before foreach: bool(false)
     $group_mods after foreach: array(1) {
      [0]=>
      object(stdClass)#5830 (1) {
        ["user_id"]=>
        int(0)
      }
    }
    Foto del perfil de Matilde Rodríguez-Castellano
     $uncached group_ids: array(0) {
    }
     $group_mods before foreach: bool(false)
     $group_mods after foreach: array(1) {
      [0]=>
      object(stdClass)#5876 (1) {
        ["user_id"]=>
        int(0)
      }
    }
    Moderadores del Grupo
    Sin mods

    The screen capture: http://imgur.com/a/0H10D

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