• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 How do I create BB code to embed tweets in posts?

TheBigK

Well-known member
#1
This question might be too naive; but I'm trying to explore the possibilities of embedding tweets in posts using custom BB codes supported by XF 1.3. Can someone describe what's the right way to make this work?
 

Valhalla

Well-known member
#2
Put this in the <head> section of your template (bear in mind it is only required in the places you wish to display a message, so 'post' templates)

Code:
<script type="text/javascript" src="http://plataform.twitter.com/widgets.js"></script>
Use this as the HTML replacement:
Code:
<blockquote class="twitter-tweet" width="370">[Javascript is not enabled. <a href="$1">Click here to view this on Twitter</a>]</blockquote>
This will allow you to include an individual Twitter message by including the full link between two tags.
 
Last edited:
#3
Can someone give me an example in which template I have to put the first code? I just want to display tweets in threads but I always get the message "Javascript is not enabled.".
 

Valhalla

Well-known member
#4
Can someone give me an example in which template I have to put the first code? I just want to display tweets in threads but I always get the message "Javascript is not enabled.".
There is a better way to achieve this by adding Twitter as a BB Code Media Site.

There is an add-on somewhere that can add it for you: http://xenforo.com/community/resources/twitter-mediasite-bbcode.1390/

I may be wrong, but by using the details above, the the Tweet will not parse if you use a quick reply (it would only display if you reload the page).
 
#5
There is a better way to achieve this by adding Twitter as a BB Code Media Site. There is an add-on somewhere that can add it for you.

I may be wrong, but by using the details above, the the Tweet will not parse if you use a quick reply (it would only display if you reload the page).
Do you mean this one? http://xenforo.com/community/resources/twitter-mediasite-bbcode.1390/
It seems to be outdated. As a result I get this: http://puu.sh/8BDgM/865dc31b78.png
And if I try to edit the post this errorlog pop up: http://puu.sh/8BDaS/f970a56a5d.png

I've also tried to add the media site manually but I got the same issue. :/
 
#6
I've found the "issue". Isn't really one but nvm. :p

If someone else has the same problem with Twitter MediaSite BBcode just delete the comment arrows in the bbms_twitter_XFormer template after the installation is complete.

Should look like this:

<!--<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>-->


<!--

If you have the twitter button deactivated and you want to use the official twitter
oembed api + twitter widget.js to build the tweet remove the comment arrows right
at the beginning and end of the first line..which would only leave the following

example: <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

-->



<script>$(".twitter-tweet").css("border","1px solid {xen:property primaryLighterStill}");</script>
<script>$(".twitter-tweet").css("border-radius", "7px");</script>
<script>$(".twitter-tweet").css("box-shadow", "0px 0px 7px 0px {xen:property primaryDarker}");</script>
<script>$(".twitter-tweet").children("p").css("border-bottom", "3px double {xen:property primaryLighterStill}"), ;</script>