joeey1984ad / buddypress-media

Automatically exported from code.google.com/p/buddypress-media
0 stars 0 forks source link

BP Album filters bp_located_template and returns non existent template #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
*** YOU MUST ANSWER ALL QUESTIONS. IF A QUESTION IS NOT RELEVANT YOU MUST
WRITE "NOT APPLICABLE" IN THE QUESTION FIELD. ***

[What steps will reproduce the problem? (We need detailed, specific steps.
If we cannot reproduce the defect on a dev machine, we cannot fix it.)]
1. Install Genesis, a child theme & GenesisConnect (commercial BP theme support 
for the the Genesis Framework).
2. Activate
3. Click the upload picture tab

[What is the expected output? What do you see instead?]

The following fatal error:

Warning: 
require_once(/home/ron/NetBeansProjects/merge/wp-content/plugins/bp-album/includ
es/templates/members/single/plugins.php) [function.require-once]: failed to 
open stream: No such file or directory in 
/home/ron/NetBeansProjects/merge/wp-includes/theme.php on line 1114

[What version of BP Media are you using?]

0.1.8.1

[What version of WordPress are you using?]

3.2.1

[What version of BuddyPress are you using?]

1.5

[What version of PHP are you using?]

See below

[If the problem is layout related (broken page layout, etc) or browser
related (page just freezes, cannot connect to server) ...what happens when
you load the page in AT LEAST TWO of the following browsers:]
1.FireFox - (Report version number)
2.Internet Explorer - (Report version number)
3.Safari - (Report version number)
4.Google Chrome - (Report version number)

All browsers have the same error

[What is the URL of your web host?]

Reported to me by a GenesisConnect user. I reproduced in my local dev install

[If you are running a public site, what is the URL to a page that shows the
problem?]

See above.

[Do you know how to use phpMyAdmin?]

Yes

[Do you know how to edit PHP code?]

Yes

[Please provide any additional information below]

Here's a fixed version of bp_album_loadb_template_filter

function bp_album_load_template_filter( $found_template, $templates ) {

    global $bp;

    if ( $bp->current_component != $bp->album->slug )
        return $found_template;

    foreach ( (array) $templates as $template ) {
        if ( file_exists( STYLESHEETPATH . '/' . $template ) )
            $filtered_templates[] = STYLESHEETPATH . '/' . $template;
        elseif ( file_exists( TEMPLATEPATH . '/' . $template ) )
            $filtered_templates[] = TEMPLATEPATH . '/' . $template;
        elseif ( file_exists( dirname( __FILE__ ) . '/templates/' . $template ) )
            $filtered_templates[] = dirname( __FILE__ ) . '/templates/' . $template;
    }

    if( !empty( $filtered_templates ) )
        $found_template = $filtered_templates[0];

    return apply_filters( 'bp_album_load_template_filter', $found_template );
}

Short explanation of the fix. You are returning a template path without 
checking to see if the template exists (which it doesn't). GenesisConnect is a 
plugin ergo, the plugin template file does not exist in either the parent or 
child theme. Like BP album, GC uses the bp_located_template to filter the 
template request and deliver the correct template to BP. Therefore it doesn't 
require any templates in the parent or child theme. 

Original issue reported on code.google.com by cronat...@gmail.com on 1 Oct 2011 at 10:32

GoogleCodeExporter commented 9 years ago
Sorry the version in use above was 0.1.8.11 (missed seeing the second 1).

Original comment by cronat...@gmail.com on 1 Oct 2011 at 10:55

GoogleCodeExporter commented 9 years ago

Original comment by fanquake on 30 Jul 2012 at 4:35

GoogleCodeExporter commented 9 years ago
I've merged your code changes.

http://code.google.com/p/buddypress-media/source/detail?spec=svn2394&r=2394

Closing as fixed.

Original comment by fanquake on 30 Jul 2012 at 5:02