Skip to:
Content
Pages
Categories
Search
Top
Bottom

Possible Bug: When Displaying a Members Loop Above Cover Image on Member Profile

  • @markob17

    Participant

    Hi,

    When trying to run a simple custom member loop (like the code example at bottom of page) on a member’s profile page, directly above their cover image header (determined it only happens when the custom loop code is ran anywhere before the <?php do_action( ‘bp_member_header_actions’ ); ?> section of that code ), it breaks the private message button.

    When you click the private message button to send a message to a member it tries to email the first member on the custom members loop instead of the actual member. Very odd.

    I need this working on and tested this on multiple Buddypress themes that utilize their own Buddypress folder structure (e.g., wp-content/themes/theme_name/buddypress) instead of those that rely on default buddypress files (e.g., wp-content/plugins/buddypress).

    I think this is a bug in Buddypress (only when using themes that override default buddypress files with their own as mentioned previously), however, I’m hoping somebody will have some answers or tips to get a simple members loop to display above the cover image header on a members profile. This should just work but doesn’t, very weird.

    Interestingly, a members loop displays above the cover image header fine on all themes that use the Buddypress default files including default WordPress themes like 2015.

    This appears to be a bug. Ideas? Any tips to get a members loop to display above cover image headers on member profile pages?

    I tried everything. Disabled all plugins of course, tested on 10 themes (3 that override buddypress files, 5 that don’t, and 2 default WordPress themes). Breaks only on themes that override buddypress files with their own.

    Additional Testing Notes: During my testing I outputted a default Buddypress widget (Buddypress: Whos Online widget – which uses a custom loop itself) above the cover image header and it didn’t break the private message button. However, when cloning that widget as a custom plugin and performing the same procedure to output it above the cover image header, it breaks the private message button on all themes that override Buddypress files but not those that utilize the default Buddypress ones.

    
    <?php if ( bp_has_members( 'type=newest&max=6' ) ) : ?>         
                        <?php while ( bp_members() ) : bp_the_member(); ?>                      
                            <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&width=125&height=125') ?></a>
                        <?php endwhile; ?>
    <?php endif; ?>
    

    Thank you for your help! I know this is a long thread. Wanted to be thorough.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @djpaul

    Keymaster

    Can you submit a bug report for the issue? It’s probably a templating global variable getting overwritten by the custom loop.

    @markob17

    Participant

    @djpaul Hi Paul,

    I have no clue what that means! Will copy my details from this ticket into a bug report when I get a chance. It’s 3:22AM so I will do so probably tomorrow.

    So I just pieced some code from Buddypress 2.5.0 (previously used code from 2.4.0 files during testing) files together using class-bp-core-whos-online-widget.php and bp-members-widgets.php to create a generic widget containing a generic loop in it. After putting that generic widget into a dynamic sidebar and then calling that sidebar above the cover image header the loop displays and doesn’t break the private message button. Weird way about getting my custom loop to display above the cover image header on a member’s profile but works for some reason. Thought I’d let you know just in case the info helps.

    Not sure why the code I pieced together from Buddypress 2.4.0 (bp-members-widgets.php) didn’t work also when I first tried this random workaround. During that round of testing the loop displayed as intended but still broke the private message button. I’m not a coder so I have no clue what is happening, I just figured it was something to do with the loading of the code so I tried random things to try and get it to work. Noticed you no longer just use bp-members-widget.php for 2.5.0 so maybe that has something to do with my workaround working now. Weird.

    Anyways, thanks for all your help. Will be great to have one of you experts take a look and remedy this quirk.

    Have a great night.

    Regards,
    mark

    @imath

    Moderator

    Hi there, what happens if you do something like this :

    <?php
    global $members_template;
    $reset_members_template = $members_template;
    
    if ( bp_has_members( 'type=newest&max=6' ) ) : ?>         
                        <?php while ( bp_members() ) : bp_the_member(); ?>                      
                            <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&width=125&height=125') ?></a>
                        <?php endwhile; ?>
    <?php endif; 
    
    $members_template = $reset_members_template;
    ?>

    Is the issue still there ?

    @markob17

    Participant

    Hi @imath!

    Interesting, I noticed the relation of those three entries were breaking the plugin/widget combination I was messing around with as a workaround. I ended up getting it to work by moving the code around in relation to those files. Took me forever though, lol. I am not a coder so have no clue what much of this stuff means but can move code around and tinker a bit.

    Anyways, I just tested out the code snippet you provided and the issue no longer occurs! Is this just the way things have to arranged in order to display a member loop above the profile? Or should I still submit a bug report?

    Thanks so much for looking into this. You guys are awesome!

    Best!
    mark

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible Bug: When Displaying a Members Loop Above Cover Image on Member Profile’ is closed to new replies.
Skip to toolbar