Show RT author information
-
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
additionalfield. The only issue there is that it’s avarchar(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 endAnd finally, because we’re adding a second
ff-namefield, the “Read on Twitter” button gets added twice, so we’ll exclude it being attached to ouradditionalfield value by changing things likes.find(".ff-userpic")tos.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.
The topic ‘Show RT author information’ is closed to new replies.