Skip to:

10/04/2015 01:47:36 PM (5 years ago)

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

1 edited


  • trunk/src/bp-activity/bp-activity-functions.php

    r10077 r10184  
    31053105 * @uses bp_is_activity_directory() to check if the current page is the activity
    31063106 *       directory.
    3107  * @uses bp_is_active() to check if the group component is active.
    31083107 * @uses bp_is_group_activity() to check if on a single group, the current page
    31093108 *       is the group activities.
    3110  * @uses bp_is_group_home() to check if the current page is a single group home
    3111  *       page.
    31123109 *
    31133110 * @return bool True if activity heartbeat is enabled, otherwise false.
    31203117    }
    3122     if ( bp_is_activity_directory() ) {
     3119    if ( bp_is_activity_directory() || bp_is_group_activity() ) {
    31233120        $retval = true;
    31243121    }
    3126     if ( bp_is_active( 'groups') ) {
    3127         // If no custom front, then activities are loaded in group's home
    3128         $has_custom_front = bp_locate_template( array( 'groups/single/front.php' ), false, true );
    3130         if ( bp_is_group_activity() || ( ! $has_custom_front && bp_is_group_home() ) ) {
    3131             $retval = true;
    3132         }
    3133     }
    31353123    return $retval;
Note: See TracChangeset for help on using the changeset viewer.