Creating a custom Front Page for your BuddyPress Groups
Creating a custom homepage for your group pages is a lot easier then you might think. This Trick will tell you exactly how to create one for one of your groups, that can be easily managed from your WordPress administration menu
Step 1: Download this plugin WP easy post types and activate.
Step 2: Create a post type called Groups
Click the drop down and add new. Add a new post type with the title of a groups slug. Example: say you have a group slug like this groups/bp-tricks, you would then create a group custom type post titled bp-tricks. Add something to the post editor box and hit save.
What we are essentially doing is tricking WP and BP into using the same URL. So by creating a custom post type with the exact URL of a group we can override the front page with a WP page and then use the post editor to create anything.
Step 4: Edit a Template
Go in to your theme folder and open groups/single/home.php
**EDIT LINE 41**
elseif ( bp_group_is_visible() && bp_is_active( 'activity' ) ) : ?>
to
elseif ( !bp_group_is_visible() ) : ?>
Step 5: Create a new template file
In the same folder groups/single/ create a file called front.php and add the following code and save:
if (have_posts()) : while (have_posts()) : the_post(); ?>
the_content(); ?>
endwhile; ?>
else >
php locate_template( array( 'groups/single/activity.php' ), true ) ?>
endif; ?>
Conclusion
Now when you visit a group it will show the custom post type page instead of the activity stream. There are some issues with the Home tab and i’m going to suggest a core change to make the tabs easier to customize.
In the mean time you could use this code to change the Home tab to activity, add this to bp-custom.php:
function my_bp_group_overrides() {
global $bp;
$bp->bp_options_nav['groups']['home']['name'] = 'Activity';
}
add_action('get_header', 'my_bp_group_overrides');
?>
You now have a custom group homepage which you can fill with content straight from your WordPress admin panel!
Awesome trick @modemlooper! Thanks.
Do you think this is a “futureproof” way of making group front pages?
Nothing is set in stone. The only core code you change is one line. The rest is a plugin and a custom file that you add. This has worked for me since the BP 1.2. If BP wasn’t so forceful with pushing the activity stream as the front page then you wouldn’t need to change the code.
I’m going to suggest a core change that allows you to choose a different group front page in admin.
As it stands you can only remove activity streams site wide but I think it should be on a group by group basis just like forums.
I think I’ll start using this on BP-Tricks for my Theme Support groups as well. Really useful Trick!
I think this is a nice! Would it be possible to this with member pages?
I’m also interested if it is possible with member pages.
I am busy trying to get the members section to work. I changed the naming to community because of legal reasons on this charity web site I am working on and then members stopped working a day or so later.
Loved your work around btw, not entirely necessary but someparts I will be using so thanks.
Any suggestions or ideas as to why the members section would stop working?
I used the .haccess to change the naming to something different and more inline with the site
define( ‘BP_FRIENDS_SLUG’, ‘friends’ );
define( ‘BP_GROUPS_SLUG’, ‘community’ );
define( ‘BP_MEMBERS_SLUG’, ‘users’ );
define ( ‘BP_WIRE_SLUG’, ‘noticeboard’ );
define( ‘BP_MESSAGES_SLUG’, ‘messages’ );
define( ‘BP_REGISTER_SLUG’, ‘register’ );
define( ‘BP_ENABLE_USERNAME_COMPATIBILITY_MODE’, true );
define( ‘BP_SEARCH_SLUG’, ‘search’ );
define( ‘BP_SETTINGS_SLUG’, ‘users-settings’ );
define( ‘BP_XPROFILE_SLUG’, ‘users-profile’ );
BTW if you are using IE6 forget looking as I have blocked that pesky browser.
http://www.energypractitionersassociation.org/community/all-energy-healing-topics/
Custom member pages should work.
On step 5, the smiley face should close with
: ?>
I followed the steps, added a page in the Groups easy post tab, but nothing shows up on the Groups pages. Any help? Thanks.
Is there a simple way to make the front page show the main group page ? ( i.e the group listings) same as you get at domainname.com/groups
Settings/Reading allows you to set a page, posts or your activity stream as the front page but not group listings page.
Hey, tried this work around, but I keep getting a syntax error message on line 1 for the Home tab where the new post should be showing up. Any ideas?
Hi,
I am using Buddy Press for my site and I want to change my group default home page to something like a blog and my users can post and entry, add some banners, etc.
Please kindly advise me.
Thanks
At the moment all my groups automatically send the user to the ‘members’ tab.
However, I want to send them to the ‘product details’ tab. Which is actually Bp docs renamed.
If docs is not enable send them to forum. (forum is renamed to discussions)
If forum is not enabled send them to members.
If you think you can fix it please update the trac:
http://tradr.com/groups/report-a-bug/forum/topic/product-groups-lands-on-discussions-tab-and-not-product-details-tab/
Cheers
Johnny.
// product details
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( ‘bp_uri’, $path );
bp_core_redirect( $path . $bp->bp_options_nav['groups']['docs']['slug'] . ‘/’ );
} else if ( $bp->groups->current_group->enable_forum ) {
// forums
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( ‘bp_uri’, $path );
bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . ‘/’ $
} else {
// members
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( ‘bp_uri’, $path );
bp_core_redirect( $path . $bp->bp_options_nav['groups']['members']['slug'] . ‘/$
}*/
We’re a bunch of volunteers and starting a brand new scheme in our community. Your website offered us with valuable information to paintings on. You have done a formidable activity and our whole group will likely be grateful to you.
Is it possible to do this and show the activity stream?
I want to show group specific info, but not completely hide the activity stream
Using the same logic of “tricking” wp by overlapping group and page slugs, wouldn’t it be possible to create a page hierarchy under the bp auto-generated “Groups” page and pull page content from there?
I gave it a try and created a set of matching bp groups and wp child-pages (under the “groups” page). Then I inserted the following page query into my empty groups/single/front.php template.
'page', 'pagename' => bp_the_group() );
query_posts( $args ); ?>
the_title();
This renders the titles and content from ALL pages that match bp-group names … hmmm. Do I need to do something with my query or loop to indicate that
'pagename' => bp_the_group()
refers only to THIS group’s name?Other than that hitch, this seems to be a good alternative to creating a separate cpt.
Sorry, the query looks like this …
'page', 'pagename' => bp_the_group() );
query_posts( $args ); ?>
the_title();
Well anyway, the point is in the query arguments
$args = array( ‘post_type’ => ‘page’, ‘pagename’ => bp_the_group() );
query_posts( $args );
while ( have_posts() ) : the_post();
the_title();
the_content();
edit_post_link()
endwhile;