Skip to:
Content

BuddyPress.org

Changeset 13200


Ignore:
Timestamp:
12/26/2021 12:40:02 PM (2 years ago)
Author:
imath
Message:

BP Nouveau: Inject Private Messages 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 have been moved out of the JS Template and a backward compatibility for potential plugins still expecting these placeholders into this templates has been put in place.

See #8474

Location:
trunk/src/bp-templates/bp-nouveau
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    r13196 r13200  
    99 * @version 10.0.0
    1010 */
     11
     12// Backward Compatibility for plugins still needing the placeholders to be located into this file.
     13if ( ! did_action( '_bp_nouveau_messages_print_placeholders' ) ) {
     14    bp_nouveau_messages_print_placeholders();
     15}
    1116?>
    12 <div class="subnav-filters filters user-subnav bp-messages-filters" id="subsubnav"></div>
    13 
    14 <div class="bp-messages-feedback"></div>
    15 <div class="bp-messages-content"></div>
    1617
    1718<script type="text/html" id="tmpl-bp-messages-feedback">
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/messages.php

    r12082 r13200  
    33 * BuddyPress - Users Messages
    44 *
     5 * @since 3.0.0
    56 * @version 3.0.0
    67 */
  • trunk/src/bp-templates/bp-nouveau/includes/messages/template-tags.php

    r12184 r13200  
    4040
    4141/**
     42 * Prints the JS Templates of the private messages UI.
     43 *
     44 * @since 10.0.0
     45 */
     46function bp_nouveau_messages_print_templates() {
     47    bp_get_template_part( 'common/js-templates/messages/index' );
     48}
     49
     50/**
     51 * Prints the HTML placeholders of the private messages UI.
     52 *
     53 * @since 10.0.0
     54 */
     55function bp_nouveau_messages_print_placeholders() {
     56    ?>
     57    <div class="subnav-filters filters user-subnav bp-messages-filters" id="subsubnav"></div>
     58
     59    <div class="bp-messages-feedback"></div>
     60    <div class="bp-messages-content"></div>
     61    <?php
     62}
     63
     64/**
    4265 * Load the new Messages User Interface
    4366 *
     
    5275    do_action( 'bp_before_member_messages_content' );
    5376
     77    /**
     78     * Load the JS templates to manage Priveate Messages into site's footer.
     79     *
     80     * @since 10.0.0 Hook to the `wp_footer` action to print the JS templates.
     81     */
     82    add_action( 'wp_footer', 'bp_nouveau_messages_print_templates' );
     83    bp_nouveau_messages_print_placeholders();
     84
     85    /**
     86     * Private hook to preserve backward compatibility with plugins needing the above placeholders to be located
     87     * into: `bp-templates/bp-nouveau/buddypress/common/js-templates/messahges/index.php`.
     88     *
     89     * @since 10.0.0
     90     */
     91    do_action( '_bp_nouveau_messages_print_placeholders' );
     92
    5493    // Load the Private messages UI
    55     bp_get_template_part( 'common/js-templates/messages/index' );
     94
    5695
    5796    /**
Note: See TracChangeset for help on using the changeset viewer.