Announcement
Collapse
No announcement yet.
Tweet BBCode
Collapse
This is a sticky topic.
X
X
-
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:
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="{param}",a,e=document.getElementsByTagName("script"),e=e[e.length-1],f;if(/^http[s]*:\/\//.test(b)){a=document.createElement("a");a.href=b;b=a.pathname.substring(a.pathname.lastIndexOf("/")+1)}f=e.parentNode.querySelector('[data-tweet-param="{param}"]: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:
- Top
- Translate
- Bottom
Leave a comment:
-
The code work on my 3.8.11 and 5.6.1 forums. It's the same code. It work with activated parameter/option. Probably, it work on vB4 too.
- Top
- Translate
- Bottom
Leave a comment:
-
Starting to think it was a twitter issue....I don't know.
- Top
- Translate
- Bottom
Leave a comment:
-
-
This doesn't seem to work on our site, recently updated to 5.6.1.
The button works but the Tweet is not displaying in the post.
- Top
- Translate
- Bottom
Leave a comment:
-
Hello. I have installed the code and it works pretty fine, however I noticed a heavy drop in speed of going back and forth between each thread pages, especially those which had the tweet in them. Like when I move to a page that has an embedded tweet, it takes ages. Is there any solution for such problem ? glennrocksvb
- Top
- Translate
- Bottom
Leave a comment:
-
work great with vBulletin Version 4.2.1
thanks a lot
- Top
- Translate
- Bottom
Leave a comment:
-
I found it Glenn. Its easier for me to do this.
- Top
- Translate
- Bottom
- Likes 1
Leave a comment:
-
The easiest way is to open a tweet by clicking on an empty space within the tweet block. It will open that single tweet and change the URL. Copy that tweet URL in the address bar. Then Paste as plain text or Paste and match style in the forum editor.
- Top
- Translate
- Bottom
Leave a comment:
-
So twitter has updated. And when i click the dropdown for a tweet i no longer get the "copy link" option. Is there a new way to get it?
- Top
- Translate
- Bottom
Leave a comment:
-
Originally posted by Fleet View PostBut i used to be able to open a tweet and simply copy the address in the browser address box. Then paste it in the bbcode. And it would be without the formatting. Interesting.
- Top
- Translate
- Bottom
- Likes 1
Leave a comment:
Users Viewing This Page
Collapse
There is 1 user viewing this forum topic.
- Guest
Latest Posts
Collapse
-
Get Affordable and Fast VPS for vBulletin -
Reply to Topic Starter Ribbon for vBCloudby glennrocksvbThanks for reporting. I'll bookmark this post and check the issue.04-22-2024, 06:40 PM
Leave a comment: