Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP Album+ problem with images path with WP in subfolder


  • Gianfranco
    Participant

    @gian-ava

    Again, I got problems because of my installation of WP in a subfolder.

    Paths for pictures uploaded via BP Album+ are broken. The image path doesn’t show the subfolder, so it’s obvoiously broken.

    The problem comes from having this code in bp-custom.php for fixing permalinks when running WP in a subfolder:

    <?php<br />
    // Getting rid of the subfolder in URLs/permalinks<br />
    function my_bp_override_core_domain() {<br />
    $domain = get_bloginfo('url');<br />
    return $domain;<br />
    }<br />
    add_filter('bp_core_get_root_domain','my_bp_override_core_domain');<br />
    ?>

    Should I change something in the plugin file. And what exactly?

Viewing 8 replies - 1 through 8 (of 8 total)

  • Gianfranco
    Participant

    @gian-ava

    This is the bit that I am sure I need to change:

    function bp_album_upload_path(){

    if ( bp_core_is_multisite() )

    $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' );

    else {

    $upload_path = get_option( 'upload_path' );

    $upload_path = trim($upload_path);

    if ( empty($upload_path) || 'wp-content/uploads' == $upload_path) {

    $path = WP_CONTENT_DIR . '/uploads';

    } else {

    $path = $upload_path;

    if ( 0 !== strpos($path, ABSPATH) ) {

    // $dir is absolute, $upload_path is (maybe) relative to ABSPATH

    $path = path_join( ABSPATH, $path );

    }

    }

    }

    $path .= '/album';

    return apply_filters( 'bp_album_upload_path', $path );

    }

    But what in there?

    And, is there a way to do it via bp-custom.php, so that I don’t need to change the plugin core file everytime there is an upgrade?


    r-a-y
    Keymaster

    @r-a-y

    Add a filter to bp_album_upload_path.

    function my_bp_album_upload_path() {
    $path = ABSPATH . 'wp-content/uploads/album';
    return $path;
    }
    add_filter('bp_album_upload_path','my_bp_album_upload_path');

    This code snippet is untested, but should give you some ideas.

    You’re basically redefining the upload path that BP Album+ has set.

    Lucky for you that the plugin offers a filter to change the upload path!


    Gianfranco
    Participant

    @gian-ava

    Thanks r-a-y, I can’t test it right now (am at the seaside), but tomorrow evening when I’ll be back, I will.

    I’ll let you know.

    ;-)


    Gianfranco
    Participant

    @gian-ava

    r-a-y, without success, I tried those two options in bp-custom.php:

    function my_bp_album_upload_path() {

    $path = ABSPATH . 'wp-content/uploads/album';

    return $path;

    }

    add_filter('bp_album_upload_path','my_bp_album_upload_path');

    and:

    function my_bp_album_upload_path() {

    $path = ABSPATH . 'site/wp-content/uploads/album';

    return $path;

    }

    add_filter('bp_album_upload_path','my_bp_album_upload_path');

    “site” is my subfolder.

    The images sources still doesn’t have the subfolder in the path.

    As I said, this is due to the previous filter:

    _bp_override_core_domain() {

    $domain = get_bloginfo('url');

    return $domain;

    }

    add_filter('bp_core_get_root_domain','my_bp_override_core_domain');


    Gianfranco
    Participant

    @gian-ava

    Still didn’t solve this. I am missing something very basic here.

    Anyone?


    Gianfranco
    Participant

    @gian-ava

    I need to fix this.

    I noticed that now Tweetstream adds a litle icon to post generated from Twitter and the image path to that icon image is broken too.

    And I can’t afford not to have broken images within Album+!

    I got WP in a subfolder and the images from plugins stuff are broken because they don’t find the right path due to a function I need to have in “bp-custom.php”, that allows me to have permalinks such as mysite.com/activity, instead of mysite.com/subfolder/activity.

    This is the code:

    function my_bp_override_core_domain() {
    $domain = get_bloginfo('url');
    return $domain;
    }
    add_filter('bp_core_get_root_domain','my_bp_override_core_domain');

    What’s the best solution, knowing that I need to keep permalinks structure without the “subfolder”?

    Should I write other functions per plugin to indicate the correct path (with “subfolder”)?

    And what this code would be?

    @r-a-y unfortunately the above code didn’t work for me.

    Please help me with this.


    Ryan Mendez
    Participant

    @streetball

    I’m having the same problem.


    foxly
    Participant

    @foxly

    We’ve just made modifications to the new BP Album+ beta that fix the problem you’re describing.

    Get it here:
    https://buddypress.org/community/groups/bp-album/forum/topic/new-bp-album-version-download-and-test/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘BP Album+ problem with images path with WP in subfolder’ is closed to new replies.
Skip to toolbar