BuddyDev

Search

Activity Plus Reloaded – Can location of link preview be changed

  • Participant
    Level: Enlightened
    Posts: 76
    Janet B on #35230

    When using the link preview option of Activity Plus Reloaded, the image preview seems to end up at the bottom of the post. This means that an activity preview will not include the graphic. Can the location of link preview relative to the rest of the post body be changed?

  • Keymaster
    (BuddyDev Team)
    Posts: 24670
    Brajesh Singh on #35238

    Hi Janet,
    Welcome to BuddyDev forums.

    Please link me to a screenshot showing the issue. That will allow to to understand and assist you better.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 76
    Janet B on #35249

    Thanks for your quick reply and library of good work.

    I am unable to attach a screenshot to the reply, but it is the “There has been an error processing your request” message that comes up if the attempt to read the URL returns anything but ‘200’

    I’ve been on WP Engine about this because the failures were so weird not fixed by restoring known working code. They sent me this long and detailed reply after doing some digging on their end.

    It is not clear to me whether the offending sites are timing out and returning nothing or whether they are returning a 404, 520, etc.

    Obviously, no one can control how a random site responds. However, setting aside previous odd behavior, what I am seeing currently is that it works fine for most sites. That is great!

    Some sites that may be under-resourced respond most of the time and fail occasionally. And some that should be working all the time, fail consistently. WashingtonPost.com is a good example.

    Janet

    ———————————-

    Hope things are going well today and thank you for providing further details. It does seems to have been a heck of a journey on your end for sure. Plugins can sometimes cause strange things to happen. Unfortunately I can’t really provide an answer into why the previous plugins/themes were working and then stop. Now only can we not replicate those issue on our end but being that this is 3rd party code our support is very limited when it comes to troubleshooting these.

    Looking at the code for BuddyPress Activity Plus they have this specific function that completely explains what is happening.

    /**
    * Get the contents from remote url.
    *
    * @param string $url Remote URL.
    *
    * @return mixed Remote page as string, or (bool)false on failure
    */
    private function get_remote_contents( $url ) {
    $response = wp_remote_get(
    $url,
    array(
    ‘user-agent’ => ‘BuddyPress Activity Plus’, // Some sites will block default WP UA.
    )
    );
    if ( is_wp_error( $response ) ) {
    return false;
    }

    $status = wp_remote_retrieve_response_code( $response );
    if ( 200 !== (int) $status ) {
    return false;
    }

    return $response[‘body’];
    }

    On this function if the URL returns a none working status that is not a 200 status. The plugin will return the error:

    There has been an error processing your request
    Which is define by the $response variable. This can be found on wp-content/plugins/bp-activity-plus-reloaded/src/handlers/class-bpapr-preview-handler.php. Looking at this code it seems the plugin and the server are working as expected. If the destination URL does not return a 200 status for any reason, it will just provide that error. Sadly we have no control over what 3rd party server do or how they handle our traffic. It could had been a temporary block or they were actually down but is nearly impossible to know from our end since we do not own or have access to those logs. Also I used the word scrapping very vaguely as an example only. The full function of the site is unknown to us since this plugin is not developed by WPEngine.

    I understand our previous techs had been doing their best to try to assist with this issue. Is very hard to try to solve an issue that can not be easily replicated and especially when the issue is happening on a 3rd party plugin. Our support is very limited when it comes to this type of plugin issues and is always best to reach out to the plugin developers for assistance. None the less our support staff will try everything they can to help and to ensure this is not a server or platform issue.

    The issue that you are experiencing with the BuddyPress Activity Plus does not seem to be really be an issue. Rather it seems to work as intended and is only providing an error when the server receives a status that is not a ‘200’. As mentioned we would not know why that server hosting the URL that was requested for a preview did not provide a good status. That is something completely out of our control as we do not host those servers. The WPEngine platform is surely working as intended and the plugin seems to work as well. However I would recommend to reach out to the BuddyPress Activity Plus to get a better understanding of their plugin site and what can be done to avoid this issues.

    Thank you so much for your patiences and we truly appreciate with business with WPEngine. If you have any questions or concerns please let us know for your convenience our chat and phone support are available 24/7.

  • Participant
    Level: Enlightened
    Posts: 76
    Janet B on #35250

    Apologies – I think I responded to the wrong question earlier. My previous reply was related to issues with basic functionality.

    In reference to the specifics about where the URL preview lands I hope I can explain it simply. Whatever text you type in is the body of the post, at the top. The URL preview lands at the bottom. If your text is short, a preview of the post includes the URL preview image. If your text is too long, the image from the URL preview gets pushed off the container boundary and you only see the text.

    I’d like to be able to locate the image at the top, if possible.

    Janet

  • Keymaster
    (BuddyDev Team)
    Posts: 24670
    Brajesh Singh on #35301

    Hi Janet,
    Thank you for the reply.
    Which theme are you using? Can you please share me a screenshot using online sharing sites such as https://prnt.sc/ or https://snipboard.io/

    Thank you
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved