After each major release of BuddyPress, the BP community discusses (in the Slack channel!) what to include in the following release. BuddyPress 2.4 is no different and includes a few new bells and whistles.
Front Page Component Search Fix
There is a bug if you have a BuddyPress component set has the front page it would then override blog post search. WordPress uses the front page with the parameter ?s= to search. BuddyPress uses ?s= as well so on the front page there is a conflict. To fix this, Boone added new default search argument for each component. Custom components can supply their own query args as well. If you have previously hard coded ?s= query arg, you may need to check your site. Only on the front page is this a huge issue. ?s= should still work for back compatibility but moving forward you should start using the new arguments specific to a component.
- During the URL parsing process, don’t interpret requests of the form example.com?s=foo as being BP component requests, even if a BP component is set to the front page.
- In order to make BuddyPress component searches continue to work, we change the default search query arguments for each component to be unique. For example, member directory searches look like example.com?members_s=foo. Components register their own ‘search_query_arg’, and these args can be filtered with the new ‘bp_core_get_component_search_query_arg’ filter.
Search Members by Type
Member types were added in BP 2.2, now there is the ability to search members in a type or not in a type. Using the following arguments passed to bp_has_members(). ‘member_typein=superhero’ would list all members of the type ‘superhero’.
member_typein or member_typenot_in
bp_has_members( ‘member_typein=superhero’ )
Profile Fields per Member Type
This feature has been in the winds for a while, and it has been included now that we have member types. When creating profile fields in the admin, there is an option to set it to a specific member type. An example of using this might be found on a site for teachers and students (see below). The personal info added to a user’s profile may be entirely unique depending on type.
BuddyPress contains a ton of templates. Accessibility work here is ongoing. There has been a focus by Mercime in 2.4 to get more accessibility fixes into the release. If you have an interest in accessibility and want to give back ping Mercime.
Profile cover images have been available in the past via plugins or added theme functionality. In 2.4, Cover Images are coming to BuddyPress core. This feature works OOTB with legacy templates and the default WordPress year themes. When the feature is active it changes the member-header.php to cover-image-header.php to include the extra markup for the image. Take note: if you have a custom member header it may override.
The feature can be turned on off in the admin BuddyPress settings or the options can be removed completely with a filter. If you have a stand alone BuddyPress theme you may need to do a little work to get this functionality working. Read the codex docs for more info.
Group Homepage Enhancement
You may have never noticed this issue–when activity is not activated the home tab on groups duplicates the members tab. In essence, the home tab never gets removed; it just uses another component to “fill in” the content. There are few other quirks in regards to how the group home page works. Imath has added a few fixes to make the homepage work like you’d expect when customizing the group homepage. Below lists the enhancements:
- Make sure an activity sub navigation will be generated if the displayed group has a custom front page.
- Make sure no members sub navigation is generated if the activity component is not active and the Group has no custom front. As, in this case, the home page of the group is already displaying the members template.
- Make sure some Groups single item conditional tags are behaving the right way:
- bp_is_group_home() is true when on the home page of the group (eg: site.url/groups/single-group/).
- bp_is_group_activity() is true 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).
- bp_is_group_members() is true 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).
- Introduce a new conditional tag: bp_is_group_custom_front() to check if the home page of the group is using a custom front template.
- Introduce a new template tag bp_groups_front_template_part() used to choose the appropriate template to load for the home page of the group (activity, members, or the custom front).
- Introduce a template hierarchy for the buddypress/groups/single/front.php template so that it is possible to have different front pages according to the ID, slug or status of the Group.
- And finally make sure the introduced improvements are back compatible with themes who forgot to update their buddypress/groups/single/home.php and buddypress/activity/post-form.php templates.
The 2.4 should be ready within a few weeks. You can always download BuddyPress 2.4 beta and test. This helps core developers by catching bugs early. I’ve been testing trunk and yet to find and major issues. This post covers some but not all of the additions included. There are always under the hood fixes added to each release.