模板更新 2.7

模板更新 2.7

Codex Home → BuddyPress Theme Development → Updating 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 include part
Groups admin manage screens
Search form for groups manage members screens
Improve group manage members screen.
Group Type front-end integration
Templates heading element changes

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:

buddypress/activity/index.php
buddypress/members/index.php
buddypress/groups/index.php
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

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.

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.

groups/single/admin/manage-members.php

Replace the blocks beginning

and ending before the final endif before start of new bp-widget div block with the one below in respective order:
Admins loop

15, ‘group_role’ => array( ‘admin’ ), ‘page_arg’ => ‘mlpage-admin’ ) ) ) : ?>

  • 1 ) : ?>
    <a class="button confirm admin-demote-to-member" href="”>

Mods loop

15, ‘group_role’ => array( ‘mod’ ), ‘page_arg’ => ‘mlpage-mod’ ) ) ) : ?>

  • <a href="” class=”button confirm mod-promote-to-admin”>
    <a class="button confirm mod-demote-to-member" href="”>

General members loop

15, ‘exclude_banned’ => 0 ) ) ) : ?>

    <li class="”>

    <?php
    if ( bp_get_group_member_is_banned() ) {
    echo ' ‘;
    _e( ‘(banned)’, ‘buddypress’ );
    echo ‘
    ‘;
    } ?>

    <a href="” class=”button confirm member-unban” title=””>

    <a href="” class=”button confirm member-ban”>
    <a href="” class=”button confirm member-promote-to-mod”>
    <a href="” class=”button confirm member-promote-to-admin”>

    <a href="” class=”button confirm”>

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:

groups/create.php
groups/groups-loop.php
groups/single/admin.php
groups/cover-image-header.php
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.

true ), ‘objects’ ) ): ?>

<label for="name ); ?>”><input type="checkbox" name="group-types[]" id="name ); ?>” value=”name ); ?>” /> labels[‘name’] ); ?>
description ) ) {
/* translators: Group type description shown when creating a group. */
printf( __( ‘– %s’, ‘buddypress’ ), ‘‘ . esc_html( $type->description ) . ‘‘ );
}
?>

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:

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.

true ), ‘objects’ ) ): ?>

<label for="name ); ?>”>
<input type="checkbox" name="group-types[]" id="name ); ?>” value=”name ); ?>” name ) ); ?>/> labels[‘name’] ); ?>
description ) ) {
printf( __( ‘– %s’, ‘buddypress’ ), ‘‘ . esc_html( $type->description ) . ‘‘ );
}
?>

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.

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.

上次修改 2021.12.31