Skip to:
Content

BuddyPress.org

Changeset 13213


Ignore:
Timestamp:
01/16/2022 02:01:10 PM (3 years ago)
Author:
imath
Message:

BP Nouveau: inject Activity Post Form 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.

See #8474

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

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/activity/post-form.php

    r12156 r13213  
    33 * BuddyPress - Activity Post Form
    44 *
     5 * @since 3.0.0
    56 * @version 3.1.0
    67 */
  • trunk/src/bp-templates/bp-nouveau/includes/activity/template-tags.php

    r13114 r13213  
    6262     */
    6363    do_action( 'bp_after_directory_activity' );
     64}
     65
     66/**
     67 * Prints the JS Templates used to render the Activity Post Form.
     68 *
     69 * @since 10.0.0
     70 */
     71function bp_nouveau_activity_print_post_form_templates() {
     72    bp_get_template_part( 'common/js-templates/activity/form' );
    6473}
    6574
     
    7382    if ( bp_nouveau_current_user_can( 'publish_activity' ) ) {
    7483        wp_enqueue_script( 'bp-nouveau-activity-post-form' );
     84
     85        /**
     86         * Get the templates to manage Group Members using the BP REST API.
     87         *
     88         * @since 10.0.0 Hook to the `wp_footer` action to print the JS templates.
     89         */
     90        add_action( 'wp_footer', 'bp_nouveau_activity_print_post_form_templates' );
    7591    }
    7692}
     
    8298 */
    8399function bp_nouveau_after_activity_post_form() {
    84     if ( bp_nouveau_current_user_can( 'publish_activity' ) ) {
    85         bp_get_template_part( 'common/js-templates/activity/form' );
    86     }
    87 
    88100    /**
    89101     * Fires after the activity post form.
Note: See TracChangeset for help on using the changeset viewer.