MyBB Community Forums

Full Version: Embed Tweet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, is there any method to embed a Tweet ?  Thanks.
(2020-12-04, 03:28 PM)meetdilip Wrote: [ -> ]Hi, is there any method to embed a Tweet ?  Thanks.

Genuinely not trying to be a jerk here, but how have you not just googled this simple question first?

I googled "mybb embed tweet" for you and there are at least 10 threads at the top of the results discussing it.

Furthermore, you really didn't give much information on what you're trying to accomplish. Do you want to just literally embed a tweet one time? You don't need anything mybb related to do that as twitter has their own embed feature here. Just paste the code where you want it.

Or are you trying to create a bbcode to automatically do this for users in posts? You need to provide more information. Regardless, the solution to that is also in the google search I spoke of earlier.


https://community.mybb.com/thread-210920...pid1319140
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Announcing the winners in the Month of LibreOffice, November 2020! If you contributed to our projects last month, you can claim a cool sticker pack, with the new LibreOffice 7 branding. Find out more here: <a href="https://t.co/Vf9dSdHQQ6">https://t.co/Vf9dSdHQQ6</a> <a href="https://t.co/hEuVgYPAGz">pic.twitter.com/hEuVgYPAGz</a></p>&mdash; LibreOffice (@libreoffice) <a href="https://twitter.com/libreoffice/status/1334805282770350082?ref_src=twsrc%5Etfw">December 4, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

The above is the output of https://publish.twitter.com

I really appreciate your attempt to help. Kindly understand that forums are a very interesting niche where asking questions is the key to the survival of the platform. Otherwise, blogs and wikis with Google search would have ruled the world. Thanks.

[twitter]https://twitter.com/libreoffice/status/1334805282770350082[/twitter]
(2020-12-04, 04:24 PM)meetdilip Wrote: [ -> ]<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Announcing the winners in the Month of LibreOffice, November 2020! If you contributed to our projects last month, you can claim a cool sticker pack, with the new LibreOffice 7 branding. Find out more here: <a href="https://t.co/Vf9dSdHQQ6">https://t.co/Vf9dSdHQQ6</a> <a href="https://t.co/hEuVgYPAGz">pic.twitter.com/hEuVgYPAGz</a></p>&mdash; LibreOffice (@libreoffice) <a href="https://twitter.com/libreoffice/status/1334805282770350082?ref_src=twsrc%5Etfw">December 4, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

The above is the output of  https://publish.twitter.com

I really appreciate your attempt to help. Kindly understand that forums are a very interesting niche where asking questions is the key to the survival of the platform. Otherwise, blogs and wikis with Google search would have ruled the world. Thanks.

Right, but at the same time if you had searched for the problem (forget about google, you can do it right here on this site), you would have seen there are many other threads already in place. Moreover, your take on search engines and wikis still doesn't negate the fact that you provided little to no information on what you're trying to accomplish.

The reason what you pasted above looks like that is because it's HTML, which isn't enabled on these posts.
And the reason the second thing you pasted looks like that is because its a bbcode and has to actually be set up, as per the instructions on the thread.
Ok, my fault.
If you want to use the HTML method in posts, you can always try:

Extend MyBB - HTML in Posts

But I'd highly recommend going the bbcode route first.
  1. Go to the ACP
  2. Click on "MyCodes" on the left sidebar
  3. Add new MyCode
  4. In "Regular Expression" paste "\[tweet\](.*?)\[/tweet\]" without the end quotes.
  5. In "Replacement" paste:
    <blockquote class="twitter-tweet"><a href="$1%"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Save and test it out.

Just tested out the code on my forum and it works great:
[Image: UG7Owj8.png]
I got an error message saying " Internal error occurred, please contact your administrator. " It is gone when I delete that mycode
(2020-12-04, 04:50 PM)meetdilip Wrote: [ -> ]I got an error message saying " Internal error occurred, please contact your administrator. " It is gone when I delete that mycode
Does this error happen right when you save the new mycode or when you try and use it in a post?
When trying to use it in a post. But I don't even get to click the " Reply " or " Edit " buttons.
(2020-12-04, 05:00 PM)meetdilip Wrote: [ -> ]When trying to use it in a post. But I don't even get to click the " Reply " or " Edit " buttons.

Hmm. First double check that you entered the "Regular Expression" and "Replacement" areas correctly in the mycode settings.

Then, try making a new post. Put whatever title, click the "view source" button (all the way to the right of the editor), and paste this exactly

[tweet]https://twitter.com/tweet/status/976297083853447168[/tweet]

Hit "preview post" and see if it works.