Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Antes on April 03, 2014, 12:59:47 PM

Title: Tweet Embed
Post by: Antes on April 03, 2014, 12:59:47 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3837)

BBCode allows you to embed tweet with its ID. This modification uses Official API to embed your tweets.

Changelog


1.1.1
- Bug in admin panel caused by auto-embed (Thanks to margarett for fixing).
1.1
- Auto Embed feature added by NanoSector
1.0
- First release, only allows BBC Embed with [tweet][/tweet].

License: MIT
Project Home: https://github.com/Antes/TweetEmbed
Title: Re: Tweet Embed
Post by: Kimmie on April 04, 2014, 12:00:37 AM
Any screenshots available?
Title: Re: Tweet Embed
Post by: Antes on April 04, 2014, 04:25:52 AM
Added a screenshot to the first post.
Title: Re: Tweet Embed
Post by: makarenıo on April 04, 2014, 11:00:41 AM
installed but there is no embed icon how can we do
Title: Re: Tweet Embed
Post by: margarett on April 04, 2014, 11:25:46 AM
Just add the ID like [tweet]your_id_here[/tweet]
This MOD does not create a button to do it for you.

Quote
1.0
- First release, only allows BBC Embed with [tweet][/tweet]
Title: Re: Tweet Embed
Post by: MotRude on April 07, 2014, 07:09:24 PM
Adding a button would make it way better..
Title: Re: Tweet Embed
Post by: THE BRA1N on April 08, 2014, 07:21:00 PM
Exactly what code should be added in between the tags? I get nothing but - Invalid Tweet ID, no matter how many tweets and 'ids' from different persons I try to embed. Some coherent instructions as to how to use this mod would be most helpful.
Title: Re: Tweet Embed
Post by: margarett on April 08, 2014, 07:25:54 PM
Just the ID.

Eg:

[tweet]441377716848574464[/tweet]

Title: Re: Tweet Embed
Post by: Antes on April 09, 2014, 01:55:16 AM
Because of my mid-term exams i had to left it at very basic level and the mod gave us (i mean me/suki/margarett) bit headache because of fetch issues & error logs. All the requests will be added to next version (Probably after 18th of this month).
Title: Re: Tweet Embed
Post by: ameo on September 11, 2014, 05:43:51 PM
Is this being improved ever gonna happen?
Title: Re: Tweet Embed
Post by: Antes on September 11, 2014, 06:10:13 PM
Quote from: ameo on September 11, 2014, 05:43:51 PM
Is this being improved ever gonna happen?

Probably not, because I'm giving most of my time to SMF 2.1 development. Sorry :( I'll try to make some time to add button to editor.
Title: Re: Tweet Embed
Post by: Apllicmz on October 10, 2014, 09:58:27 AM
Nice Work
Good Mod
Update Portuguese Cod

<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[// Tweet Embed
$txt['invalid_tweet'] = 'ID inv&aacute;lido do Tweet';
]]></add>
        </operation>
    </file>
    <file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[// Tweet Embed
$txt['invalid_tweet'] = 'ID inv&aacute;lido do Tweet';
]]></add>
        </operation>
    </file>
Title: Re: Tweet Embed
Post by: Antes on December 29, 2014, 02:48:36 PM
1.1
- Auto Embed feature added by NanoSector

:D
Title: Re: Tweet Embed
Post by: Paracelsus on February 27, 2015, 04:22:43 PM
Hi,

The MOD works fine, but I think there might be a bug somewhere, because after installing it the BBCode admin area just disappears (please see attached image). I get it back with all the bbcode options when I uninstall the MOD.
Title: Re: Tweet Embed
Post by: Burke ♞ Knight on February 27, 2015, 04:34:14 PM
I noticed that, too. However, I usually leave all selected anyway, so not an emergency issue for me.
Although, it does need to be fixed.
Title: Re: Tweet Embed
Post by: Paracelsus on March 02, 2015, 04:47:34 AM
It's this part that disables it:

// Embed Twitter Tweets.
$message = preg_replace("/https?:\/\/(www.)?twitter.com\/[a-zA-Z0-9_]+\/status\/(\d+)/i", "[tweet]$2[/tweet]", $message);
Title: Re: Tweet Embed
Post by: Antes on March 02, 2015, 05:05:33 AM
I'm aware of the issue, unfortunately I don't have any time to look for fix :( that line disables the auto-embed option.
Title: Re: Tweet Embed
Post by: margarett on March 03, 2015, 11:11:40 AM
Should be easy enough:
// Embed Twitter Tweets.
if (!empty($message))
$message = preg_replace("/https?:\/\/(www.)?twitter.com\/[a-zA-Z0-9_]+\/status\/(\d+)/i", "[tweet]$2[/tweet]", $message);
Title: Re: Tweet Embed
Post by: Antes on March 03, 2015, 11:27:18 AM
Thanks a lot :) I'm uploading 1.1.1.
Title: Re: Tweet Embed
Post by: luuuciano on March 03, 2015, 11:53:13 AM
Very nice mod! simple and efective
Tried the other one, finally we are using yours

KUDOS

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.imgion.com%2Fimages%2F01%2FYou-will-rock.jpg&hash=2b91804e0d9a27451806144e9892255e9a79e325)
Title: Re: Tweet Embed
Post by: Paracelsus on March 05, 2015, 03:34:58 AM
Perfect fix @margarett, thanks.  ;)
Title: Re: Tweet Embed
Post by: Paracelsus on July 01, 2015, 07:41:29 PM
Some of our users have noticed that after autoembedding a tweet the smilies that come afterwards don't parse anymore as they supposed to. Even enclosing the tweet around another bbcode tag doesn't work because it doesn't recognize the closing tag after the autoembedded tweet.
Title: Re: Tweet Embed
Post by: Douglas on July 30, 2015, 11:12:33 PM
Antes, if I can make a tiny suggestion... I'd love to use this Mod package, but only if two other methods were also available for the tweet BBC code.

Currently, you only allow for status ID to be used. Most people are not going to be savvy enough or want to strip out just the ID code.

If you could also build in support for:
[tweet]https://twitter.com/BearlyDoug/status/626549963024146433[/tweet]
[tweet]http://twitter.com/BearlyDoug/status/626549963024146433[/tweet]

(with and without the WWW), that would make this feature absolutely PERFECT.
Title: Re: Tweet Embed
Post by: Antes on July 31, 2015, 03:51:22 AM
Modification has auto-embed option, just paste the link :)
Title: Re: Tweet Embed
Post by: Douglas on July 31, 2015, 07:35:06 AM
I did... got an invalid tweet ID warning for some reason. Let me re-install it.

EDIT: Attached two screenshots.

https://twitter.com/BadPhotoshopHog/status/626936027542867968 is the source URL used
Title: Re: Tweet Embed
Post by: Antes on July 31, 2015, 08:09:27 AM
You don't need to use tweet tag with auto-embed option just paste the link.
Title: Re: Tweet Embed
Post by: Douglas on July 31, 2015, 08:14:36 AM
/me facepalms himself

Can't believe it was *that* simple. I am sorry for wasting your time, Antes. :(

Let me say that I absolutely LOVE this Mod package. And many Hogvillians will, as well!
Title: Re: Tweet Embed
Post by: Antes on July 31, 2015, 08:47:52 AM
Quote from: Douglas on July 31, 2015, 08:14:36 AM
/me facepalms himself

Can't believe it was *that* simple. I am sorry for wasting your time, Antes. :(

Let me say that I absolutely LOVE this Mod package. And many Hogvillians will, as well!

nah np :P, I should rewrite the readme thingy.
Title: Re: Tweet Embed
Post by: Douglas on July 31, 2015, 10:55:50 AM
Okay, legit bug report this time. :)

Quotehttp://www.hogville.net/yabbse/index.php?action=post;msg=9797708;topic=595789.50
8: Undefined index: twithash
Apply Filter: Only show the errors from this file
File: /XX/XX/XX/yabbse/Sources/BBCTwitter.php
Line: 89

Line 89 is noted below:
$buttons[count($buttons) - 1][] = array(
'image' => 'twithash',
'code' => 'hashtag',
'before' => '[hashtag]',
'after' => '[/hashtag]',
'description' => $txt['twithash']              // <----- LINE 89
);


It appears you're missing $txt['twithash'] from Modifications.english.php (and any other language file).

I added this to the file:
$txt['twithash'] = 'Twitter Hashtag';

Same issue for $txt['twitacc']

$buttons[count($buttons) - 1][] = array(
'image' => 'twitacc',
'code' => 'twitacc',
'before' => '[twitacc]',
'after' => '[/twitacc]',
'description' => $txt['twitacc']
);


Added this to Modifications.english.php:
$txt['twitacc'] = 'Twitter Account';

Same for this one...
$buttons[count($buttons) - 1][] = array(
'image' => 'twitmessage',
'code' => 'tweet',
'before' => '[tweet]',
'after' => '[/tweet]',
'description' => $txt['twitmessage']
);


Added $txt['twitmessage'] to Modifications.english.php

// Tweet Embed
$txt['invalid_tweet'] = 'Invalid Tweet ID';
$txt['twithash'] = 'Twitter Hashtag';
$txt['twitacc'] = 'Twitter Account';
$txt['twitmessage'] = 'Twitter Message';
Title: Re: Tweet Embed
Post by: Antes on July 31, 2015, 01:47:33 PM
Are you sure you are using this modification :D :D this mod doesn't have BBCTwitter.php file.

/me confused bit...
Title: Re: Tweet Embed
Post by: Douglas on July 31, 2015, 04:12:42 PM
Hmph... weird. Guess I need to track down where I'm seeing that. Might be another mod that didn't get cleaned up properly upon removal
Title: Re: Tweet Embed
Post by: JTVaughn on September 11, 2015, 07:06:17 AM
Quote from: Paracelsus on July 01, 2015, 07:41:29 PM
Some of our users have noticed that after autoembedding a tweet the smilies that come afterwards don't parse anymore as they supposed to. Even enclosing the tweet around another bbcode tag doesn't work because it doesn't recognize the closing tag after the autoembedded tweet.

I'm having this issue too, is there a fix?
Title: Re: Tweet Embed
Post by: Gluz on September 12, 2015, 07:04:53 AM
I have this installed in two forums + 2 test forums copy of the 2 main forums, and in one of my test forums it works well, no problems with smilies after the embed tweet, and the live version have same everything except one MOD in the test site, and that MOD added a fix for AutoLinkURLs conflict with their MOD, and surprisingly that fix this bug as well.

It seems that somehow after the positive validate/fetch tweet data, the smilies doesn't get parsed when the tweets are odd number, if you put a pair number of tweets the smilies get parsed well, and from there I can't follow the huge parse_bbc() function to understand what can be done there.

The MOD Hide Content (http://custom.simplemachines.org/mods/index.php?mod=4013) have a fix in the last update that fixes this bug too, and after strip some code to test the exact code that do the trick I see that a dirty hack can be used but is not the best way to solve this:

This doesn't parse the smilies after an Embed Tweet
$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);

This does
$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg'], array('non_existent_BBC_tag'));
$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);


Specifying a non existent BBC tag to the BBC parser it only parses the smilies and do it well, and the next will parse all the tags.

Maybe the team can find a way to modify the parse_bbc() function to save some cycles and fix the bug instead of that hack, because that hack need to be done in every call to parse_bbc() function, and as far as I see there are 15 places where need to put something similar to get it work in every place where a post can be showed.
Title: Re: Tweet Embed
Post by: stefan357965 on September 13, 2015, 06:20:59 PM
Quote from: luuuciano on March 03, 2015, 11:53:13 AM
Very nice mod! simple and efective
Tried the other one, finally we are using yours

KUDOS

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.imgion.com%2Fimages%2F01%2FYou-will-rock.jpg&hash=2b91804e0d9a27451806144e9892255e9a79e325)

And the picture wins! :D
Title: Re: Tweet Embed
Post by: JTVaughn on September 17, 2015, 03:00:15 PM
Bump for help with above issues
Title: Re: Tweet Embed
Post by: TLMB on September 18, 2015, 04:52:39 PM
Thank you for this mod. :)
Title: Re: Tweet Embed
Post by: Count on February 27, 2016, 04:44:03 AM
It appears that the automatic twitter link parser breaks stuff if someone has linked with url bbcode. Something like [ url=https://www.twitter.com/whatever ] whatever [ /url ] shows the url with a hanging [/tweet] tag and looks really ugly. Tested on 2.0.11, when using 1.0 without the automatic parser everything works fine.
Title: Re: Tweet Embed
Post by: CreativeITWorld.com on July 26, 2016, 03:30:18 PM
Centering Tweets

Find
[tweet]$2[/tweet]

Replace with
[center][tweet]$2[/tweet][/center]
Title: Re: Tweet Embed
Post by: Dwev on February 27, 2018, 10:58:57 AM
I was happily using the mod in my forum, when today I noticed that it always embeds the parent tweet as well.

That's quite a problem when you want to include multiple tweets from a Twitter-thread, because you get every tweet double (once on it's own, and once in the next tweet as the parent tweet).

Is there maybe a way do disable the showing of the prent tweet?
Title: Re: Tweet Embed
Post by: pocttopus on July 21, 2018, 12:23:39 PM
This mod is not working properly.  :-[
Is there any way to configure this!?

(https://s20.postimg.cc/qh8kmds3x/Capture_T.jpg)
Title: Re: Tweet Embed
Post by: luuuciano on July 22, 2018, 10:14:58 AM
Is that on firefox? maybe it is his tracking protection?
Title: Re: Tweet Embed
Post by: pocttopus on July 23, 2018, 04:40:12 AM
Yes, it's firefox.
It works on IE but I am not that mad to use it in the future.  :-[
Title: Re: Tweet Embed
Post by: luuuciano on July 24, 2018, 08:55:32 AM
Try Turn off Tracking Protection for individual sites
https://support.mozilla.org/en-US/kb/tracking-protection

If it works after disabling it...
Title: Re: Tweet Embed
Post by: pocttopus on July 25, 2018, 05:16:51 PM
Quote from: luuuciano on July 24, 2018, 08:55:32 AM
Try Turn off Tracking Protection for individual sites
https://support.mozilla.org/en-US/kb/tracking-protection

If it works after disabling it...
It works!
Thanks.  ;) :)
Title: Re: Tweet Embed
Post by: Yoksven on January 16, 2021, 07:24:27 PM
This mod isn't working in the way I was expecting. I thought it would embed tweet with BBcode, but instead it embeds tweets even without it. I often paste tweet links just as links using url tag or wrapped around an image, but with this mod installed it gets weird (illustration of the weird (https://i.ibb.co/w4M7S94/Illustration2.jpg)).

I wonder if there's any way to modify this mod to make it embed tweets only when BBcode [tweet][/tweet] is used and not do anything with tweet links otherwise?