No "add group" button in buddypress

I do not have a "add group" button in the groups section. I can add a group through control panel or navigation directly to the create page but buddypress is not inserting the add group button into the group or profile section.

The buddypress forum says that this is caused by the_title() being used outside the loop. This is confusing to me, I have been adding in the_title() in various places but nothing has worked.

My main buddypress.php file in the root of my theme has the intial loop like this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
		<h2><strong><?php the_title(); ?></strong></h2>
		<div class="row">
			<div class="col-md-12">
				<?php the_content(); ?>
				<?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( 'Pages: ', 'buddypress' ), 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
				<?php edit_post_link( __( 'Edit this page.', 'buddypress' ), '<p class="edit-link">', '</p>'); ?>
			</div>
		</div>
	<?php endwhile; ?>
	<?php endif; ?>

What exactly did I do wrong?

In my buddypress folder in my theme (copied from legacy) I have tried putting the_title() in the groups loops and in various places but it hasn't helped.

Does anyone know what they mean by moving the_title() inside the loop? It looks to me like I have done that.

  • Michael Bissett

    Hey @Mike, hope you're doing well this evening! :slight_smile:

    In my buddypress folder in my theme (copied from legacy) I have tried putting the_title() in the groups loops and in various places but it hasn't helped.

    From looking into this, I do have to wonder... did you copy this file:

    /buddypress/bp-templates/bp-legacy/buddypress/groups/index.php

    Inside of that file, you'll see this action hook:

    do_action( 'bp_groups_directory_group_filter' );

    Inside of that file, it's what's responsible for loading the "Create a Group" button on the groups page.

    Another way of handling this was brought up by the makers of the BuddyBoss theme:

    http://www.buddyboss.com/support-forums/topic/how-to-create-groups-from-front-end/#post-26104

    The key thing being the snippet mentioned, the placement inside of the template file would depend on your theme.

    Hope this helps! :slight_smile:

    Kind Regards,
    Michael

  • Mike

    Hi Michael,

    I copied that page and now if I visit "domain.com/groups/" there is a create group button.

    I thought though that there was a add group button in "domain.com/members/name/groups"?

    The template file that should be responsible I guess is "buddypress/members/single/groups.php".

    I added "do_action( 'bp_groups_directory_group_filter' );" to the groups.php and now there is a create group link there. I like the buddyboss method, I need to familiarize myself with the code to the level that I don't rely on mysterious functions firing on hooks.

    Buddypress is awesome and there are some really helpful docs but I wish there was a list of all the hooks and functions with a useful description next to each. Code comments are helpful but it always feel like looking for a needle in a haystack.

    Thanks for the help Michael!

  • Michael Bissett

    Hey @Mike, glad you got all of this working! :slight_smile:

    I thought though that there was a add group button in "domain.com/members/name/groups"?

    It doesn't look to be there by default, from my own investigating. You're right about the page template you needed to edit, good job on getting that sorted out!

    Buddypress is awesome and there are some really helpful docs but I wish there was a list of all the hooks and functions with a useful description next to each. Code comments are helpful but it always feel like looking for a needle in a haystack.

    You may wish to check out this resource over here, it'd be at least a step in that general direction:

    http://hookr.io/plugins/buddypress/

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.