Auto thread Thumbnail by Xenbros - Xenforo 2

Auto thread Thumbnail by Xenbros - Xenforo 2 2.3.4

  • Thread starter Thread starter xenvn
  • Start date Start date
Auto thread Thumbnail by Xenbros.webp


Auto thread Thumbnail by Xenbros - a plugin that adds a picture to a theme using the first attachments attached to the topic and the first external URL.
 

Attachments

Last edited by a moderator:

🔧 XenForo Add-on Debug Tip – xenbros/Auto Threadthumbnail​


❗ Error:​

Code:
You must log in to view
(2 lines)

📄 File to Edit:​

Code:
You must log in to view
(1 lines)

Method:
PHP:
You must log in to view
(1 lines)

🧩 Cause:​

The method tries to manually build a full base URL using:
PHP:
You must log in to view
(1 lines)
However, the XF\Http\Request class does not have a getUri() method, causing a fatal error.

---

❌ Incorrect Code (Do NOT use):​

PHP:
You must log in to view
(4 lines)

✅ Correct Code (Use This Instead):​

PHP:
You must log in to view
(3 lines)

---

🛠️ Fix Instructions:​

1. Open the file:
Code:
You must log in to view
(1 lines)
2. Find the method:
getfirstPostImgUrl()
3. Replace the block that uses getUri() with the corrected version above.
4. Save and recompile templates if needed.

---

💡 Bonus Tip:​

  • 'attachments' → returns a relative URL: /attachments/xyz.jpg
  • 'canonical:attachments' → returns a full URL: https://example.com/attachments/xyz.jpg

Use canonical: when generating image URLs for email templates, OG/meta previews, or anywhere a full URL is required.

---

Hope this helps you avoid the same issue! 👍
 
Similar content Most view View more
Back
Top Bottom