Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp groups loop signs out user?!


  • eyedraw
    Participant

    @eyedraw

    I have this weird bug: When I try to retrieve all of the current users’ groups, not only are just the public groups displayed, it also seems like the user is half signed out. Although the current username is still displayed in the header, the wp admin bar shows a sign-in button (as shown in the picture here). Also, as said before, only public groups of the user are displayed.

    This is my Code:

    <?php get_header();
     $current_user = get_current_user_id();
     
     $args = array(
        'user_id' => $current_user
    );
    ?>
    <div id="primary" class="content-area container">
    		<main id="main" class="site-main">
                <?php
                    if ( bp_has_groups ( $args ) ) {
    /* also tried bp_groups($args) here */
                        while ( bp_groups() ) : bp_the_group(); ?>
                            <a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a>
                        <?php endwhile;
                    } ?>
            </main>
    </div>
    <?php
    get_sidebar();
    get_footer();
    ?>

    I’m running the newest wordpress and buddypress versions.

Viewing 2 replies - 1 through 2 (of 2 total)

  • Henry Wright
    Moderator

    @henrywright

    Try running this using something like Twenty Fifteen with all plugins deactivated. My guess is your code works but something else is conflicting.


    eyedraw
    Participant

    @eyedraw

    found the issue by accident… Had used the $current-User variable in the header.php before. Why I couldn’t overwrite that and just reuse it is a riddle to me. But that broke the group loop (eventhough the correct ID was returned… oh well)
    thanks

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