Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/04/2015 01:47:36 PM (4 years ago)
Author:
imath
Message:

Improve template loading for Groups single items home pages.

  • 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.

Props r-a-y, boonebgorges, DJPaul, and imath :)

Fixes #6388

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-screens.php

    r10158 r10184  
    739739     */
    740740    bp_core_load_template( apply_filters( 'groups_template_group_request_membership', 'groups/single/home' ) );
     741}
     742
     743/**
     744 * Handle the loading of a single group's activity.
     745 *
     746 * @since 2.4.0
     747 */
     748function groups_screen_group_activity() {
     749
     750    if ( ! bp_is_single_item() ) {
     751        return false;
     752    }
     753
     754    /**
     755     * Fires before the loading of a single group's activity page.
     756     *
     757     * @since 2.4.0
     758     */
     759    do_action( 'groups_screen_group_activity' );
     760
     761    /**
     762     * Filters the template to load for a single group's activity page.
     763     *
     764     * @since 2.4.0
     765     *
     766     * @param string $value Path to a single group's template to load.
     767     */
     768    bp_core_load_template( apply_filters( 'groups_screen_group_activity', 'groups/single/activity' ) );
    741769}
    742770
Note: See TracChangeset for help on using the changeset viewer.