WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Activity Plus
[resolved] Bug in thumbnail image URL generation on link sharing? (6 posts)

  1. edwardtownend
    Member
    Posted 1 month ago #

    Hi, I think I've found a bug in generating URLs to thumbnail images when sharing links. If the link is a subdirectory (eg. 'domain.com/blog/postid'), and image chosen uses a root-relative URL (eg. '/images/logo.png') which would work out to 'domain.com/images/logo.png', instead activity plus generates the URL 'domain.com/blog/post///images/logo.png' which will obviously 404.

    Hope this helps! Thanks for the plugin, it's otherwise great!

    https://wordpress.org/plugins/buddypress-activity-plus/

  2. WPMU DEV
    Member
    Posted 1 month ago #

    Hi @edwardtownend,

    Sorry to hear of the problem you are having.

    Could you please share me the example link where you are facing this issue so that i can reproduce it on my test site?

    Kind Regards,
    WPMU DEV

  3. edwardtownend
    Member
    Posted 1 month ago #

    Hi, this link originally caused the issue.

    http://www.madeleinelindley.com/ecommerce/partnerships/cornerstones-education/

    Thanks!

  4. WPMU DEV
    Member
    Posted 3 weeks ago #

    Hi @edwardtownend,

    Thank you for your reply and sharing the page link.

    I could reproduce the same issue on my test site therefore i have notified the plugin developer to fix it in the plugin.

    Meanwhile you can fix it by editing the BuddyPress Activity Plus plugin files as following.

    BuddyPress Activity Plus plugin file:
    buddypress-activity-plus\lib\class_bpfb_binder.php

    On line number 230

    Before Editing:

    header('Content-type: application/json');
    echo json_encode(array(
    	"url" => $url,
    	"images" => $images,
    	"title" => $title,
    	"text" => $text,
    ));

    After Editing:

    $site_url = parse_url($url, PHP_URL_HOST);
    header('Content-type: application/json');
    echo json_encode(array(
    	"url" => $url,
    	"images" => $images,
    	"title" => $title,
    	"text" => $text,
    	"site_url" => $scheme."://".$site_url
    ));

    BuddyPress Activity Plus plugin file:
    buddypress-activity-plus\js\bpfb_interface.js

    On line number 124

    Before Editing:

    var url = img.match(/^http/) ? img : data.url + '/' + img;

    After Editing:

    var url = img.match(/^http/) ? img : data.site_url + "/" +img;

    Note: You are making changes in the plugin file and these changes will be overwritten and lost when you update the plugin and you will have to make these again after plugin updation.

    Best Regards,
    WPMU DEV

  5. edwardtownend
    Member
    Posted 3 weeks ago #

    Thanks very much for your help, I've changed the given lines and that seems to work perfectly.

  6. WPMU DEV
    Member
    Posted 3 weeks ago #

    You are most welcome, if I can be of any further assistance please don't hesitate to ask :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.