Skip to:
Content

BuddyPress.org

Ticket #6610: 6610.patch

File 6610.patch, 1.8 KB (added by imath, 9 years ago)
  • src/bp-core/bp-core-attachments.php

    diff --git src/bp-core/bp-core-attachments.php src/bp-core/bp-core-attachments.php
    index 1fadb11..aeb25de 100644
    function bp_attachments_get_template_part( $slug ) { 
    395395
    396396        // Load the attachment template in WP Administratin screens
    397397        if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
    398                 $attachment_admin_template_part = buddypress()->themes_dir . '/bp-legacy/buddypress/' . $attachment_template_part . '.php';
     398                // BP Legacy Templates dir
     399                $attachment_admin_templates_dir = buddypress()->themes_dir . '/bp-legacy/buddypress/';
    399400
    400                 // Check the template part exists
     401                // Path to the BP Legacy template
     402                $attachment_admin_template_part = $attachment_admin_templates_dir . $attachment_template_part . '.php';
     403
     404                // The template part is not in BP Legacy, maybe in a plugin?
    401405                if ( ! file_exists( $attachment_admin_template_part ) ) {
    402                         return false;
     406
     407                        /**
     408                         * Filter here by returning true and setting your own path to your attachment template part using
     409                         * $attachment_admin_template_part (passed by reference)
     410                         *
     411                         * @since  2.4.0
     412                         *
     413                         * @param  bool   $value True to use a custom template
     414                         * @param  string $attachment_admin_template_part Path to the template part passed by reference
     415                         * @param  string $slug the requested template slug eg: 'uploader' or 'custom_dir/custom_template'
     416                         */
     417                        if ( false === apply_filters_ref_array( 'bp_attachments_get_admin_template_part', array( false, &$attachment_admin_template_part, $slug ) ) ) {
     418                                return false;
     419
     420                        // A plugin is wishing to use his template part, let's check it exists.
     421                        } elseif ( ! file_exists( $attachment_admin_template_part ) ) {
     422                                return false;
     423                        }
    403424                }
    404425
    405426                // load the template part