• Resolved disagree

    (@disagree)


    On twitter RT’s, we want to show the retweeted owner’s status, for this to happen I’ve added this line in FFTwitter.php :

    
    if($t['retweeted_status']) {
    	@$tc->additional["nickname"] = '@'.$t['retweeted_status']['user']['screen_name'];
    	@$tc->additional["screenname"] = (string)$t['retweeted_status']['user']['name'];
    	@$tc->additional["id"] = $t['retweeted_status']['id_str'];
    	@$tc->additional["userpic"] = str_replace('.jpg', '_200x200.jpg', str_replace('_normal', '', (string)$t['retweeted_status']['user']['profile_image_url']));
    	@$tc->additional["rt"] = true;
    }
    

    This will save the RT data into the additional field. The only issue there is that it’s a varchar(300), which maybe could be expanded to a bigger field instead.

    Then in getText($tweet) we’re defaulting to the retweeted tweet instead of the main tweet :

    
    private function getText($tweet){
    	if (isset($tweet['retweeted_status'])) {
    		$tweet = $tweet['retweeted_status'];
    	}
    

    Then in public.js ( which is super hard to work with, would be great if you could add a source map, or a unminified version for it ), we add this line somewhere around where the original twitter information is displayed :

    
    // old : ( just reformatted to have line endings )
        y.text = '<div class="ff-content">' + l.text + "</div>",
        y.meta = '',
        y.meta += '<div class="ff-item-meta"><span class="ff-userpic" style="background:url(' + ("yep" === V.forceHTTPS ? l.userpic.replace("http:", "https:") : l.userpic) + ')">',
        y.meta += '<i class="ff-icon ff-label-' + F[l.feed].type + '"><i class="ff-icon-inner"></i></i></span><h6><a rel="nofollow" href="' + l.userlink + '" class="ff-name ' + (l.userlink ? "" : " ff-no-link") + '">' + l.screenname + '</a></h6><a rel="nofollow" href="' + l.userlink + '" class="ff-nickname' + (l.userlink ? "" : " ff-no-link") + '">' + (l.nickname ? l.nickname : l.screenname) + '</a><a rel="nofollow" href="' + l.permalink + '" class="ff-timestamp">' + H(l.system_timestamp, l.timestamp) + "</a>",
    // new start
        l.additional.rt && ( 
            l.additional.userlink = 'https://twitter.com/' + l.additional.nickname.replace("@", ""),
            l.additional.permalink = 'https://twitter.com/' + l.additional.nickname.replace("@", "") + '/status/' + l.additional.id,
            y.meta += '<div class="clearfix" style="margin:10px 0; border-top: 2px dashed lightgrey"></div>',
            y.meta += '<span class="ff-userpic ff-additional" style="background:url(' + ("yep" === V.forceHTTPS ? l.userpic.replace("http:", "https:") : l.additional.userpic) + ')">',
            y.meta += '<i class="ff-icon ff-label-' + F[l.feed].type + '"><i class="ff-icon-inner"></i></i></span>',
            y.meta += '<h6><a rel="nofollow" href="' + l.additional.userlink + '" class="ff-name ff-no-link">' + l.additional.screenname + '</a></h6>',
            y.meta += '<a rel="nofollow" href="' + l.additional.userlink + '" class="ff-nickname ff-no-link">' + (l.additional.nickname ? l.additional.nickname : l.additional.screenname) + '</a>',
            y.metaaa += '<a rel="nofollow" href="' + l.additional.permalink + '" class="ff-timestamp">' + H(l.system_timestamp, l.timestamp) + "</a>"
        ),
    // new end
    

    And finally, because we’re adding a second ff-name field, the “Read on Twitter” button gets added twice, so we’ll exclude it being attached to our additional field value by changing things like s.find(".ff-userpic") to s.find(".ff-userpic").not('.ff-additional') 3 times.

    This way we can see now the original account information that retweeted a status, and the RT’s author information.

    • This topic was modified 7 years, 2 months ago by disagree.
Viewing 1 replies (of 1 total)
  • Plugin Support Oleksandr

    (@awesomeoman)

    Hi, thank you very much for this! We will review and try to implement.

Viewing 1 replies (of 1 total)

The topic ‘Show RT author information’ is closed to new replies.