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.  :)
Please 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.
Please 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.
Please do not PM me for support.

Advertisement: