Important changes to how BuddyPress is loading the Groups component single items home pages have been committed to trunk and will be included in our next major release: 2.4.0.
Here are the most important things you absolutely need to know, of course, you can read the full story on this ticket: #6388.
To better understand the moves we are doing, let’s do a “Before & After” about Groups homes.
So far (soon “before” by the time 2.4.0 is released)
When the Group’s home page loads, BuddyPress is first looking if a front.php
template (Themes can use it to customize all the Groups home pages) exists in the active_theme/buddypress/groups/single
folder (1). If it doesn’t find it, BuddyPress is checking if the Activity component is active before loading the buddypress/groups/single/activity.php
template (2). If the activity component is not active, then BuddyPress will load the buddypress/groups/single/members.php
template (3).
(2) is the most common case and everything works fine! the activity template is the home page of the Group and Group members can share activities into the Group.
Now let’s see (3) in action:
In this case, all Groups will display the members of the Group twice: into the Group’s home and under the Members sub navigation.
(1) is a bit more problematic.
If your theme is including a front.php
template, then all Groups homes are displaying this custom template, but they all loose the activity feature 😦
Soon (once 2.4.0 is released)
During the 2.4.0 dev cycle, we’ve been working on cases (1) and (3) and we are very happy to announce that 2.4.0 will not only fix them but also open new customization possibilities for the Group’s home page.
Here’s the Group’s home when the Activity component is not active (3 – fixed).
Here’s the Group’s home when the active theme includes a custom front.php
template (1 – fixed).
There’s more!
We’ve also added a new Template Hierarchy for the front.php
template.
Now, you can have a different home page according to some of the Group properties. For example, you can “restrict” a specific front page according to the Group’s ID, or its slug using the following namings for your front template: front-id-{ID}.php
or front-slug-{slug}.php
.
You can also choose to “restrict” a front page according to the Group’s status (public/private/hidden) using this kind of naming: front-status-{status}.php
Have a look at the delicious Group’s home @mercime & i have built on our test drive 🙂
Important changes in some Group’s conditional tags
Plugin developers and theme designers, please note the following changes :
- Like before,
bp_is_group_home()
istrue
when on the home page of the group (eg: site.url/groups/single-group/). - From now on:
bp_is_group_activity()
istrue
when the activity page of the Group is displayed. It can be the home page of the group or its activity page (eg: site.url/groups/single-group/activity). - From now on:
bp_is_group_members()
istrue
when the members page of the group is displayed. It can be the home page of the group or its members page (eg: site.url/groups/single-group/members).
This is really very very important: if you need to add some features inside the Activity page of the Group you will use bp_is_group_activity()
. I strongly recommend that you check your plugins and themes to see if you were using bp_is_group_home()
to know if the Group Activities were displayed. In this case, as soon as 2.4.0 is released, i strongly advise you to use bp_is_group_activity()
instead.
Changes in 2 templates
If you are a theme designer or if you’ve overridden one or both of the following templates, please note you’ll need to update them once 2.4.0 is released (even if we made sure these improvements are back compatible with your “old” templates).
buddypress/groups/single/home.php
(view the diff)buddypress/activity/post-form.php
(view the diff)
Finally, don’t forget to test that everything works fine for you during the 2.4.0 beta period 🙂