Skip to:
Content
Pages
Categories
Search
Top
Bottom
Codex HomeBuddyPress Theme DevelopmentUpdating Custom Themes For New Functionality → Template Updates 2.7

Template Updates 2.7

In BuddyPress 2.7 we introduce some new features that specifically require template adjustment.

These changes are of importance for theme developers who may have overloaded the templates to the themes directory and these will need to be updated from the details here. If you are simply inheriting templates then there is no need to worry. Do note however some updates are not critical but are enhancements theme developers might like to carry through to their templates.

Changes for this release are:

Directory Search Form (Trac #6844)

We introduced a new folder for themes to hold common shared parts; in this we have added a revised copy of the directories search form that is included into all main directory component screens.

This is not a breaking change; if you choose not to update templates the search elements will function normally.

Files needing updating are:

  1. buddypress/activity/index.php
  2. buddypress/members/index.php
  3. buddypress/groups/index.php
  4. buddypress/blogs/index.php

If you need to make changes to the shared search form, create a new folder in your /buddypress/ or /community/ directories named common/search/ and copy in the new file from bp-legacy then modify.

In all of the above files, locate the search form block and replace with

<?php bp_get_template_part( 'common/search/dir-search-form' ); ?>

Groups Admin Manage Screens (Trac #7079 )

groups/single/admin.php is now broken out by admin screen for ease of editing and overriding indivdual screens.

Although no changes are required, as there is no appreciable change other than convenience for developers, you might like to examine groups/single/admin.php & single/admin/ to see the changes and perhaps copy over.


Search Form for Groups Manage Members Screens (Trac #6385)

Adds search capability to the admin manage members screen.

  1. groups/single/admin.php

If you’ve added the new bp_before_group_admin_form action to groups/single/admin.php, and have not overridden bp-legacy/buddypress-functions.php, then a search form will be added above the manage members list. If you have overridden bp-legacy/buddypress-functions.php, see the changeset for implementation details.


Groups Manage Members Lists (Trac #7105)

This update improves the structure of list items to more closely match members-loop.php.

Although this isn’t a breaking change you may like to update any overloaded templates for this improvement.

  1. groups/single/admin/manage-members.php

Replace the blocks beginning <div class="bp-widget"> and ending before the final endif before start of new bp-widget div block with the one below in respective order:

Admins loop


<div class="bp-widget group-members-list group-admins-list">

<h3 class="section-header"><?php _e( 'Administrators', 'buddypress' ); ?></h3>


  <?php if ( bp_group_has_members( array( 'per_page' => 15, 'group_role' => array( 'admin' ), 'page_arg' => 'mlpage-admin' ) ) ) : ?>

   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>


<ul id="admins-list" class="item-list">
    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

<li>

<div class="item-avatar">
       <?php bp_group_member_avatar_thumb(); ?>
      </div>

<div class="item">

<div class="item-title">
        <?php bp_group_member_link(); ?>
       </div>



        <?php bp_group_member_joined_since(); ?>


       <?php /** * Fires inside the item section of a member admin item in group management area. * * @since 1.1.0 * @since 2.7.0 Added $section parameter. * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_item', 'admins-list' ); ?>
      </div>



<div class="action">
       <?php if ( count( bp_group_admin_ids( false, 'array' ) ) > 1 ) : ?>
        <a class="button confirm admin-demote-to-member" href="<?php bp_group_member_demote_link(); ?>"><?php _e( 'Demote to Member', 'buddypress' ); ?></a>
       <?php endif; ?>

       <?php /** * Fires inside the action section of a member admin item in group management area. * * @since 2.7.0 * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_actions', 'admins-list' ); ?>
      </div>

     </li>

    <?php endwhile; ?>
   </ul>


   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>

  <?php else: ?>


<div id="message" class="info">


<?php _e( 'No group administrators were found.', 'buddypress' ); ?>

  </div>

Mods loop


<div class="bp-widget group-members-list group-mods-list">

<h3 class="section-header"><?php _e( 'Moderators', 'buddypress' ); ?></h3>


  <?php if ( bp_group_has_members( array( 'per_page' => 15, 'group_role' => array( 'mod' ), 'page_arg' => 'mlpage-mod' ) ) ) : ?>

   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>


<ul id="mods-list" class="item-list">

    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

<li>

<div class="item-avatar">
       <?php bp_group_member_avatar_thumb(); ?>
      </div>



<div class="item">

<div class="item-title">
        <?php bp_group_member_link(); ?>
       </div>



        <?php bp_group_member_joined_since(); ?>


       <?php /** * Fires inside the item section of a member admin item in group management area. * * @since 1.1.0 * @since 2.7.0 Added $section parameter. * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_item', 'admins-list' ); ?>
      </div>



<div class="action">
       <a href="<?php bp_group_member_promote_admin_link(); ?>" class="button confirm mod-promote-to-admin"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a>
       <a class="button confirm mod-demote-to-member" href="<?php bp_group_member_demote_link(); ?>"><?php _e( 'Demote to Member', 'buddypress' ); ?></a>

       <?php /** * Fires inside the action section of a member admin item in group management area. * * @since 2.7.0 * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_actions', 'mods-list' ); ?>

      </div>

     </li>

    <?php endwhile; ?>

   </ul>


   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>

  <?php else: ?>


<div id="message" class="info">


<?php _e( 'No group moderators were found.', 'buddypress' ); ?>

   </div>

General members loop


<div class="bp-widget group-members-list">

<h3 class="section-header"><?php _e( "Members", 'buddypress' ); ?></h3>


  <?php if ( bp_group_has_members( array( 'per_page' => 15, 'exclude_banned' => 0 ) ) ) : ?>

   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>


<ul id="members-list" class="item-list" aria-live="assertive" aria-relevant="all">
    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>


<li class="<?php bp_group_member_css_class(); ?>">

<div class="item-avatar">
       <?php bp_group_member_avatar_thumb(); ?>
      </div>



<div class="item">

<div class="item-title">
        <?php bp_group_member_link(); ?>
        <?php
        if ( bp_get_group_member_is_banned() ) {
         echo ' <span class="banned">';
         _e( '(banned)', 'buddypress' );
         echo '</span>';
        } ?>
       </div>



        <?php bp_group_member_joined_since(); ?>


       <?php /** * Fires inside the item section of a member admin item in group management area. * * @since 1.1.0 * @since 2.7.0 Added $section parameter. * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_item', 'admins-list' ); ?>
      </div>



<div class="action">
       <?php if ( bp_get_group_member_is_banned() ) : ?>

        <a href="<?php bp_group_member_unban_link(); ?>" class="button confirm member-unban" title="<?php esc_attr_e( 'Unban this member', 'buddypress' ); ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a>

       <?php else : ?>

        <a href="<?php bp_group_member_ban_link(); ?>" class="button confirm member-ban"><?php _e( 'Kick &amp; Ban', 'buddypress' ); ?></a>
        <a href="<?php bp_group_member_promote_mod_link(); ?>" class="button confirm member-promote-to-mod"><?php _e( 'Promote to Mod', 'buddypress' ); ?></a>
        <a href="<?php bp_group_member_promote_admin_link(); ?>" class="button confirm member-promote-to-admin"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a>

       <?php endif; ?>

       <a href="<?php bp_group_member_remove_link(); ?>" class="button confirm"><?php _e( 'Remove from group', 'buddypress' ); ?></a>

       <?php /** * Fires inside the action section of a member admin item in group management area. * * @since 2.7.0 * * @param $section Which list contains this item. */ do_action( 'bp_group_manage_members_admin_actions', 'members-list' ); ?>
      </div>

     </li>


    <?php endwhile; ?>
   </ul>


   <?php if ( bp_group_member_needs_pagination() ) : ?>


<div class="pagination no-ajax">


<div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count(); ?>
     </div>



<div id="member-admin-pagination" class="pagination-links">
      <?php bp_group_member_admin_pagination(); ?>
     </div>


    </div>


   <?php endif; ?>

  <?php else: ?>


<div id="message" class="info">


<?php _e( 'No group members were found.', 'buddypress' ); ?>

   </div>


Group Type Front-End Integration ( Trac #7210 )

This feature updated and extended the work done on establishing a group type taxonomy in 2.6; it provides for front-end integration of type selection and management in the group creation steps & the manage settings screens.

In this release two new template tags are added that display all group types on a groups loop display & the current group type(s) on a single group screen. The following templates need updating:

  1. groups/create.php
  2. groups/groups-loop.php
  3. groups/single/admin.php
  4. groups/cover-image-header.php
  5. groups/group-header.php

create.php: in the create step 2 screen we display a list of group types to select from. The markup below needs to be copied after the privacy options block and before the group invitations on screen 2 although you can move this where you need it.

    <?php // Group type selection ?>
    <?php if ( $group_types = bp_groups_get_group_types( array( 'show_in_create_screen' => true ), 'objects' ) ): ?>

<fieldset class="group-create-types">

<legend><?php _e( 'Group Types', 'buddypress' ); ?></legend>

<?php _e( 'Select the types this group should be a part of.', 'buddypress' ); ?>


      <?php foreach ( $group_types as $type ) : ?>

<div class="checkbox">
        <label for="<?php printf( 'group-type-%s', $type->name ); ?>"><input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php echo esc_attr( $type->name ); ?>" /> <?php echo esc_html( $type->labels['name'] ); ?>
         <?php if ( ! empty( $type->description ) ) {
           /* translators: Group type description shown when creating a group. */
           printf( __( '&ndash; %s', 'buddypress' ), '<span class="bp-group-type-desc">' . esc_html( $type->description ) . '</span>' );
          }
         ?>
        </label>
       </div>


      <?php endforeach; ?>

     </fieldset>


    <?php endif; ?>

groups-loop.php: In the groups-loop template we have a template tag to display a group directory message. This block would be copied to a position just before the bp_has_group() query:

<?php if ( bp_get_current_group_directory_type() ) : ?>


<?php bp_current_group_directory_type_message() ?>

<?php endif; ?>

admin.php / group-settings.php: In 2.7 we split the admin manage file into separate includes so the block below is either copied just before the group-create-invitation fieldset or simply copy over the newer template parts to your theme.

<?php // Group type selection ?>
<?php if ( $group_types = bp_groups_get_group_types( array( 'show_in_create_screen' => true ), 'objects' ) ): ?>


<fieldset class="group-create-types">

<legend><?php _e( 'Group Types', 'buddypress' ); ?></legend>


<?php _e( 'Select the types this group should be a part of.', 'buddypress' ); ?>


  <?php foreach ( $group_types as $type ) : ?>

<div class="checkbox">
    <label for="<?php printf( 'group-type-%s', $type->name ); ?>">
     <input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php echo esc_attr( $type->name ); ?>" <?php checked( bp_groups_has_group_type( bp_get_current_group_id(), $type->name ) ); ?>/> <?php echo esc_html( $type->labels['name'] ); ?>
     <?php if ( ! empty( $type->description ) ) {
       printf( __( '&ndash; %s', 'buddypress' ), '<span class="bp-group-type-desc">' . esc_html( $type->description ) . '</span>' );
      }
     ?>
    </label>
   </div>


  <?php endforeach; ?>

 </fieldset>


<?php endif; ?>

cover-image-header.php & group-header.php: both these header files get a new template tag for displaying the group type for that group. Copy the tag below to the #item-header-content div or position of your choice.

<span class="highlight"><?php bp_group_type(); ?></span>

Template Heading Element Changes

In 2.7 we have adjusted many of the heading elements used to effect a better and proper document outline structure and improved accessibility.

This is more an advisory notice as the styling of these element has been adjusted in the default BP stylesheets to minimize the visual change.

There may be cases where themes have overloaded BP stylesheets but not templates in which case those developers may want to check through the various headings for any necessary styling updates required, e.g. font-size changes.

Skip to toolbar