Removed, I don't want to confuse people with a different code.
Announcement
Collapse
No announcement yet.
Tweet BBCode
Collapse
This is a sticky topic.
X
X
-
Fixed and updated code in the first post.
Here's a sample tweet URL with querystring parameters:
https://twitter.com/vbmodsthatrock/status/1489663748491157511?s=20&t=3i-9zc-TquBRaRNe6r2otg
Last edited by glennrocksvb; 02-26-2022, 05:50 PM.
My Amazon Affiliate Link β
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
- Likes 1
Comment
-
I checked and I confirmed that Firefox is not showing the embedded tweet. After investigating, Firefox is blocking Social Media trackers (which include Twitter) by default using the default "Strict" mode for Enhanced Tracking Protection option.
If you click the shield icon next to the SSL lock icon in the Firefox address bar, you will see "Social Media Trackers" is blocked. If you expand it, you will see the Twitter API URL. If you want to change the security settings, click "Manage protection settings" and switch from "Strict" to "Standard" and then click "Reload All Tabs" and then check that the embedded tweet should now be displayed.
My Amazon Affiliate Link β
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
Hello Glenn. I am writing this message because none of the icons that I put in the bbcode work right. With the tiktok one, in the preview, it looks correct. However, when I go to post it, I only get the actual tiktok line. I was wondering what I am doing wrong.Originally posted by glennrocksvb View PostOne way to integrate social media with forums is to embed tweets from Twitter into forum posts.
Go to AdminCP > Custom BB Codes > Add New BB Code and enter the following information:
Title: Tweet
BB Code Tag Name: tweet
Replacement: (Updated code as of 02/26/22 to fix issue for Tweet URL with querystring parameters)
Example: [tweet]TweetUrlOrTweetIdHere[/tweet]Code:<div data-tweet-param="{param}"></div><script>(function(){function k(a,c){var d=Element.prototype;return(d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.msMatchesSelector||function(a){return-1!==[].indexOf.call(document.querySelectorAll(a),this)}).call(a,c)}function g(a,c){return a?k(a,c)?a:"HTML"===a.tagName?null:g(a.parentNode,c):null}var b,u=`{param}`.replace(/<br\s*[\/]?>/gi, '').replace(/\r|\n/g,'').replace(new RegExp(unescape('%26amp;'), 'g'),unescape('%26')),a,e=document.getElementsByTagName("script"),e=e[e.length-1],f;if(/^http[s]*:\/\//.test(u)){a=document.createElement("a");a.href=u;b=a.pathname.substring(a.pathname.lastIndexOf("/")+1)}f=e.parentNode.querySelector('[data-tweet-param*="'+u+'"]:empty');(a=g(f,".js-post"))?a=a.getAttribute("data-node-id"):(a=g(f,".js-post-sm"),a=a?a.getAttribute("data-nodeid"):Math.floor(Math.random()*10000));a="t_"+(a||"")+"_"+b;window[a]=function(a){f.innerHTML=a.html;a=f.getElementsByTagName("script");for(var c,d=document.getElementsByTagName("head")[0],b=0;b<a.length;b++)a[b].src?(c=document.createElement("script"),c.src=a[b].src,d.appendChild(c)):eval(a[b].textContent)};var h=document.createElement("script");h.src="https://api.twitter.com/1/statuses/oembed.json?id="+b+decodeURIComponent("%26")+"callback="+a;e.parentNode.appendChild(h)})();</script>
Other Options: Select Yes to all starting from "Remove Tag If Empty" option (for Button Image option, you could specify image path. If specified, a new button for this BB Code will appear in the editor)
Demo:
This tweet:
[tweet]https://twitter.com/noypiscripter/status/758114543033647104[/tweet]
or just using the Twitter Post ID
[tweet]758114543033647104[/tweet]
will be rendered as:
To get the Tweet URL, go to a tweet on Twitter, click on the 3 dots icon below the tweet, choose "Copy link to Tweet" and then copy the URL.
Other sample:
None of them work correctly. How can I fix this?
- Top
- Translate
- Bottom
Comment
-
The Twiiter JS API is returning 404 Not Found error. They might have changed the API location since they changed to X or they did deprecated the old Twitter API.
My Amazon Affiliate Link β
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
I'll research for the new X API and update the BBCode.
My Amazon Affiliate Link β
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
Seems like the Twitter BBCode is now working. I didn't have to make any change. Maybe there was just a glitch on Twitter side before.Originally posted by lottidah View PostTest Tweet.

My Amazon Affiliate Link β
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
- Likes 1
Comment
Latest Posts
Collapse
-
Reply to some ideas for new modsin Chit Chatby desmomax
I finally created a mod that allows you to add an icon to each post with options for sharing on other platforms. I honestly thought it was absurd that...
Today, 03:59 AM -
by flohseHi Glenn, what do you think about adding "Like Counts" similar to "Like Counts on Postbit and Profile" (when this mod is in use) in...Yesterday, 11:28 PM
-
Reply to push notification prompt?by desmomaxhy glenn
have you thought about this?Yesterday, 05:44 AM

Comment