Skip to:
Content

BuddyPress.org

Changeset 11821


Ignore:
Timestamp:
01/25/2018 08:23:37 PM (7 years ago)
Author:
djpaul
Message:

Templates: improvements to template loading methods.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r11780 r11821  
    804804        bp_update_is_directory( true, bp_current_component() );
    805805
    806     $template_part = $object . '/' . $object . '-loop';
    807 
    808806    // The template part can be overridden by the calling JS function.
    809     if ( ! empty( $_POST['template'] ) ) {
    810         $template_part = sanitize_option( 'upload_path', $_POST['template'] );
    811     }
    812 
    813     // Locate the object template.
    814     bp_get_template_part( $template_part );
     807    if ( ! empty( $_POST['template'] ) && 'groups/single/members' === $_POST['template'] && 'group_members' === $object ) {
     808        $template_part = 'groups/single/members.php';
     809    } else {
     810        $template_part = $object . '/' . $object . '-loop.php';
     811    }
     812
     813    $template_path = bp_locate_template( array( $template_part ), false );
     814
     815    $template_path = apply_filters( 'bp_legacy_object_template_path', $template_path );
     816
     817    load_template( $template_path );
    815818    exit();
    816819}
  • trunk/src/bp-templates/bp-nouveau/includes/ajax.php

    r11686 r11821  
    8888    }
    8989
    90     $template_part = $object . '/' . $object . '-loop';
    91 
    9290    // The template part can be overridden by the calling JS function.
    93     if ( ! empty( $_POST['template'] ) ) {
    94         $template_part = sanitize_option( 'upload_path', $_POST['template'] );
     91    if ( ! empty( $_POST['template'] ) && 'groups/single/members' === $_POST['template'] && 'group_members' === $object ) {
     92        $template_part = 'groups/single/members.php';
     93    } else {
     94        $template_part = $object . '/' . $object . '-loop.php';
    9595    }
    9696
    9797    ob_start();
    98     bp_get_template_part( $template_part );
     98
     99    $template_path = bp_locate_template( array( $template_part ), false );
     100    $template_path = apply_filters( 'bp_legacy_object_template_path', $template_path );
     101
     102    load_template( $template_path );
    99103    $result['contents'] = ob_get_contents();
    100104    ob_end_clean();
Note: See TracChangeset for help on using the changeset viewer.