Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/18/2021 07:25:13 PM (3 years ago)
Author:
imath
Message:

Inject Group's Invites & Manage Members JS templates into footer

To make sure JS Templates are injected without being altered in WordPress themes supporting the Full Site Editing feature, we are now doing it inside the page's footer.

HTML placeholders for both UI have been moved out of the JS Templates and a backward compatibility for potential plugins still expecting these placeholders into these templates has been put in place.

See #8474

File:
1 edited

Legend:

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

    r13185 r13193  
    65816581    return file_exists( bp_locate_template( 'common/js-templates/group-members/index.php' ) );
    65826582}
     6583
     6584/**
     6585 * Prints the JS Templates to manage the Group's members.
     6586 *
     6587 * @since 10.0.0
     6588 */
     6589function bp_groups_print_manage_group_members_templates() {
     6590    bp_get_template_part( 'common/js-templates/group-members/index' );
     6591}
     6592
     6593/**
     6594 * Prints the HTML placeholders to manage the Group's members.
     6595 *
     6596 * @since 10.0.0
     6597 */
     6598function bp_groups_print_manage_group_members_placeholders() {
     6599    ?>
     6600    <div id="group-manage-members-ui" class="standard-form">
     6601        <ul class="subnav-filters">
     6602            <li id="group-roles-filter" class="last filter"><?php // Placeholder for the Group Role Tabs ?></li>
     6603            <li id="group-members-pagination" class="left-menu"><?php // Placeholder for paginate links ?></li>
     6604            <li id="group-members-search-form" class="bp-search"><?php // Placeholder for search form ?></li>
     6605        </ul>
     6606        <table id="group-members-list-table" class="<?php echo is_admin() ? 'widefat bp-group-members' : 'bp-list'; ?>"><?php // Placeholder to list members ?></table>
     6607    </div>
     6608    <?php
     6609}
     6610
     6611/**
     6612 * Outputs the Manage Group Members Backbone UI.
     6613 *
     6614 * @since 10.0.0
     6615 *
     6616 * @param string $hook The hook to use to inject the JS Templates.
     6617 */
     6618function bp_groups_manage_group_members_interface( $hook = 'wp_footer' ) {
     6619    /**
     6620     * Get the templates to manage Group Members using the BP REST API.
     6621     *
     6622     * @since 5.0.0
     6623     * @since 10.0.0 Hook to the `wp_footer` action to print the JS templates.
     6624     */
     6625    add_action( $hook, 'bp_groups_print_manage_group_members_templates' );
     6626    bp_groups_print_manage_group_members_placeholders();
     6627
     6628    /**
     6629     * Private hook to preserve backward compatibility with plugins needing the above placeholders to be located
     6630     * into: `bp-templates/bp-nouveau/buddypress/common/js-templates/group-members/index.php`.
     6631     *
     6632     * @since 10.0.0
     6633     */
     6634    do_action( '_bp_groups_print_manage_group_members_placeholders' );
     6635}
Note: See TracChangeset for help on using the changeset viewer.