Skip to:
Content

BuddyPress.org

Ticket #6024: 6024.01.patch

File 6024.01.patch, 1.9 KB (added by dcavins, 10 years ago)

Allow plugins to filter bp-legacy AJAX template selection.

  • src/bp-templates/bp-legacy/buddypress-functions.php

    diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php
    index 727a16d..b174227 100644
    function bp_legacy_theme_object_template_loader() { 
    605605                $template_part = sanitize_option( 'upload_path', $_POST['template'] );
    606606        }
    607607
     608        // Allow plugins to filter the template location
     609        $filter_name = 'bp_legacy_theme_' . $object . '_template_loader';
     610        $template_part = apply_filters( $filter_name, $template_part );
     611
    608612        // Locate the object template
    609613        bp_get_template_part( $template_part );
    610614        exit();
    function bp_legacy_theme_object_template_loader() { 
    617621 * @since BuddyPress (1.6)
    618622 */
    619623function bp_legacy_theme_messages_template_loader() {
    620         bp_get_template_part( 'members/single/messages/messages-loop' );
     624        $template = 'members/single/messages/messages-loop';
     625        $template = apply_filters( 'bp_legacy_theme_messages_template_loader', $template );
     626        bp_get_template_part( $template );
    621627        exit();
    622628}
    623629
    function bp_legacy_theme_messages_template_loader() { 
    627633 * @since BuddyPress (2.0.0)
    628634 */
    629635function bp_legacy_theme_invite_template_loader() {
    630         bp_get_template_part( 'groups/single/invites-loop' );
     636        $template = 'groups/single/invites-loop';
     637        $template = apply_filters( 'bp_legacy_theme_invite_template_loader', $template );
     638        bp_get_template_part( $template );
    631639        exit();
    632640}
    633641
    function bp_legacy_theme_invite_template_loader() { 
    637645 * @since BuddyPress (2.0.0)
    638646 */
    639647function bp_legacy_theme_requests_template_loader() {
    640         bp_get_template_part( 'groups/single/requests-loop' );
     648        $template = 'groups/single/requests-loop';
     649        $template = apply_filters( 'bp_legacy_theme_requests_template_loader', $template );
     650        bp_get_template_part( $template );
    641651        exit();
    642652}
    643653