Announcement

Collapse
No announcement yet.

How to fix Access Denied errors for some sites (e.g. Shopify) on URL Preview feature in vB 5.7.2

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Free Mod How to fix Access Denied errors for some sites (e.g. Shopify) on URL Preview feature in vB 5.7.2

    Starting vB 5.7.2, a new feature called "URL Preview" was implemented. If you place a URL on its own line in a post, it will display a thumbnail, title and description from the linked page after posting. However, some sites (e.g. Shopify) display a broken image and "Access denied" as page title. Some sites may display a different wrong preview output but the root cause may still be the same.

    To fix this issue, it requires editing 2 CORE PHP files. This means it can only be done on self-hosted vB5 version and not on vBCloud.

    First PHP file:
    1. Log in to your server using cPanel or FTP.
    2. Open and edit the following file in a code editor.
      Code:
      core/vb/utility/url.php
    3. Find the following lines:
      PHP Code:
      //    const USERAGENT = 64; 
      PHP Code:
      //            case self::USERAGENT: 
    4. Uncomment the lines by removing the //.
    5. Find the following line:
      PHP Code:
      curl_setopt($chCURLOPT_HTTPHEADER$headers); 
    6. Add the following code right below the code in Step 5:
      PHP Code:
          if (!empty($this->options[self::USERAGENT]))
          {
          
      curl_setopt($chCURLOPT_USERAGENT$this->options[self::USERAGENT]);
          }
      ​ 
    7. Save the file.

    Second PHP file:
    1. ​Open and edit the following file in a code editor.
      Code:
      core/vb/api/content/link.php
    2. Find the following line:
      PHP Code:
      $vurl->setOption(vB_Utility_Url::HEADER1); 
    3. ​Add the following code below the code in Step 2:
      PHP Code:
      $vurl->setOption(vB_Utility_Url::USERAGENT$_SERVER['HTTP_USER_AGENT']); 
    4. Save the file.
    5. After editing both files, log in to AdminCP and clear the system cache in Maintenance > Clear System Cache.
    If you are using the default vB5 PHAR (PHP Archive) package, then you won't be able to see the second file. You need to download the non-PHAR version of the package and upload it to your server with the following steps.
    1. Log in to vbulletin.com
    2. Go to Members Area
    3. Go to the vB 5.7.2 download page.
    4. Choose "More Download Options" radio button option.
    5. Choose No for the "Use compressed PHP Archive:" radio button option.
    6. Check the "I agree" checkbox.
    7. Click Download button.
    8. Extract the compressed package file.
    9. Login to your server using FTP or SSH.
    10. Upload the contents of the upload/core/vb folder to the core/vb​ folder on your server. Overwrite files when prompted.
    11. You can now find and edit the second PHP file.

    Before fix:

    Click image for larger version

Name:	image.png
Views:	1725
Size:	46.8 KB
ID:	25971​


    After fix:

    Click image for larger version

Name:	image.png
Views:	219
Size:	166.7 KB
ID:	25972

    Enjoy!

    Please let me know if this solution works for your or not.

    If you find this useful, feel free to share it with others.​
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    #2
    Some sites may still display a blank image if the linked page has no image in the content or if vB failed to extract an image for some other reasons. In that case, you can display a default thumbnail icon of your own instead of showing a blank or broken thumbnail. Follow below link for the solution.

    https://vbmods.rocks/forum/vbulletin...-7-2
    Last edited by glennrocksvb; 01-17-2023, 01:02 PM.
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      I filed the below bug ticket in vB so that they can officially fix this issue on their end.



      Please vote for it to get their attention.
      Helpful? Donate. Thanks!
      Buy me a coffeePayPal QR Code
      Fast VPS Host for vBulletin:
      A2 Hosting & IONOS

      Comment


        #4
        For issue on non-square thumbnails showing just part of the image, please see this solution:

        https://vbmods.rocks/forum/vbulletin...t-of-the-image​
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #5
          This looks like fixed in the upcoming vB 5.7.3.
          Helpful? Donate. Thanks!
          Buy me a coffeePayPal QR Code
          Fast VPS Host for vBulletin:
          A2 Hosting & IONOS

          Comment

          Users Viewing This Page

          Collapse

          There is 1 user viewing this forum topic.

          • Guest Guest

          Latest Posts

          Collapse

          Working...
          X
          Searching...Please wait.
          An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

          Please push the back button and reload the previous window.'
          An unexpected error was returned: 'Your submission could not be processed because the token has expired.

          Please push the back button and reload the previous window.'
          An internal error has occurred and the module cannot be displayed.
          There are no results that meet this criteria.
          Search Result for "|||"