Auto Tweet Embed

Started by vbgamer45, January 11, 2015, 03:21:09 PM

Previous topic - Next topic

Julius_2000

#240
Quote from: Steve on September 07, 2022, 07:20:24 AM
Quote from: vbgamer45 on September 06, 2022, 09:02:23 AMCheck that the mod was not installed twice if every post has two of the twitter posts inside it.
Quote from: Julius_2000 on September 06, 2022, 10:13:41 AMWe are currently running a public forum with SMF 2.0.19 and a test forum with the latest 2.1.2 version. On the old forum tweets work as intented, only the test forum won't work. Is there a way for non-hosts (me) to see possible duplicates of mods? In the Admin section, I can only see this mod once.
You would have to look at the file edits this mod does and make sure the changes weren't made more than once.

Oh, I think you pointed to something. I just went back to the mod page and looked at the modfications it' does to php files using "parse". And it looks like there's a double entry in the load.php

Quote// Auto Embed Twitter
    global $boardurl;
   
    if (!function_exists("set_tld_regex"))
        $context['html_headers'] .=  '
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>';
   
    $context['html_headers'] .=  '
    <script type="text/javascript">
        $(document).ready(function() {

        var oTwitter = $(\'a[href*="twitter.com"][href*="/status"]\');
        if (oTwitter.length > 0) {
            oTwitter.each(function() {
                var oHolder = $(this);
                var sStr = $(this).attr(\'href\');
                sStr = sStr.replace(/\/+$/, "");
                sStr = sStr.substr(sStr.lastIndexOf(\'/\') + 1);
                $.getJSON("' . $boardurl .'/tweet-cache.php?id=" + sStr, function(data) {
                    oHolder.before(data.html);
                });
            });
        }

        });
    </script>';
    //end Auto Embed Twitter
           
   
    // Auto Embed Twitter
    global $boardurl;
   
    if (!function_exists("set_tld_regex"))
        $context['html_headers'] .=  '
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>';
   
    $context['html_headers'] .=  '
    <script type="text/javascript">
        $(document).ready(function() {

        var oTwitter = $(\'a[href*="twitter.com"][href*="/status"]\');
        if (oTwitter.length > 0) {
            oTwitter.each(function() {
                var oHolder = $(this);
                var sStr = $(this).attr(\'href\');
                sStr = sStr.replace(/\/+$/, "");
                sStr = sStr.substr(sStr.lastIndexOf(\'/\') + 1);
                $.getJSON("' . $boardurl .'/tweet-cache.php?id=" + sStr, function(data) {
                    oHolder.before(data.html);
                });
            });
        }

        });
    </script>';
    //end Auto Embed Twitter

Could I delete one of these entries without corrupting the rest?

Also, there's a double entry in the modifications.english.php
Quote// Begin Auto Embed Twitter Strings
$txt['autotwitter_tweeterror'] = 'Tweet error (does not exist)';
$txt['autotwitter_blankid'] = 'Tweet error (blank ID)';
// END Auto Embed Twitter Strings

One is at the beginning of the code, the other at the end. Can I delete the second one, too?


Edit: I think that did the trick! Tweets now embed only once.
The issue with editing posts still remains. Tweets won't get shown when I edit any post, even if I only save without editing anything at all.

vbgamer45

Nice, glad that solved one of the bugs!
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Steve

It sounds like you went ahead and deleted the duplicates but if not, the answer to both your questions is yes.  :)
DO NOT pm me for support!

Julius_2000

Ha, Steve, yes I was bold and tried it out. I have access to the ftp server so I made a backup before modifying the phps in case it wouldn't work out.

Thank you guys, you've all been really helpful!!

Maybe we need to set up the new forum all over again to get rid of some things like that.

Steve

If this is a brand new forum, that probably wouldn't be a bad idea.

https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files

Do a backup and then you should be able to re-install this mod with no problems.
DO NOT pm me for support!

vbgamer45

I can't recreate the edit issue on my SMF 2.1.x board. I am able to edit the post either full edit or quick edit and the embeding still works.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Julius_2000

Thank you so much guys. I think there might have gone something wrong while fiddeling with the code or whatever, given that there was also a double entry in the load.php etc.
Shouldn't be too hard to set it up fresh and then upload the theme and mods again, I hope.


Steve

If you've got all the double entries removed, it should be working.
DO NOT pm me for support!

guvenck

Hello,

I was using Auto Twitter Embed 1.1 with SMF 2.0.15.

I noticed that the tweets were not embedding for some time. So I updated the mod to 3.0 version.

Tweets are still not embedding,
no entries at all in smf_tweets_cache table,
and there are 503 errors in the console (for every tweet link).

Like:
Quotejquery is already loaded with version: 3.6.0
result of version check: 1
Failed to load resource: the server responded with a status of 503 (),
https://myforumsite.com/forum/tweet-cache.php?id=1603079336277458944 [nofollow]



Steve

DO NOT pm me for support!

vbgamer45

Check file permissions on tweet-cache.php they need to be adjusted.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

guvenck

Quote from: vbgamer45 on December 20, 2022, 10:36:42 AMCheck file permissions on tweet-cache.php they need to be adjusted.

Thank you vbgamer. File permissions were fine (666). It looks it was the PHP version. It was 7.1 and upon upgrading to 7.4 tweets started displaying. Now I have to deal with its side effects (Depreciated create_function errors etc.), which brings me to Steve's question, it is time for 2.1.3 :)

Btw, I am getting lots of Content blocker errors on Safari. Because of loading external content in an iframe. Any workaround about this?

QuoteContent blocker prevented frame displaying https://myforum.com/forum/index.php?topic=6313.msg1805094;boardseen#new [nofollow] from loading a resource from https://syndication.twitter.com/i/jot/embeds [nofollow]?

20abc22

I have installed this mod successfully, according to the messages I received. But the tweets basically look like links.

Yes, my version (2.1.3) is not officially supported, but can there be something I can check out that could be fixed to get this to work.

Thank you.

vbgamer45

I would check your javascript error log in your browser to see if any errors that might be related on a page with twitter links
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

dmsolovyev

Hello there! The mod works absolutely fine for me, so I have an opposite problem  :D
Is it possible to disable embedding for the specific link (or post)?

What I want is the standard forum behavior for handling url, i.e. I'd like to be able to use the url bb code for twitter links, like this:
[url=https://twitter.com/bbcworld/status/1610105681285111808]text[/url]
Any ideas guys?  :)

vbgamer45

Not possible currently.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

zorer

Hi! i tried this mod a in a fresh installation of SMF 2.1.3, posted a twitter link and nothing happen, i checked the permissions of the file tweet-cache.php and changed from 666 to 777, but nothing happend too, no error logs too.

vbgamer45

I would have to check if this still works. Twitter might have changed some stuff...
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

zorer

#258
Well i tried in a smf 2.1.3 installed in localhost and the autoembed works fine, looks i have some issues with my hosting about this mod
Any idea what i'm missing / is wrong in the hosting?
Thanks!

zorer

Well, i have asked to my hosting service and they have answered me that this mod is not compatible with my environment, but that this other mod works https://custom.simplemachines.org/index.php?mod=3837 , to use that one.

Advertisement: