Code

Discussion on Ultimate Twitter Feed Class

Discussion on Ultimate Twitter Feed Class

Cart 400 sales

AustinBrunkhorst does not currently provide support for this item.

125 comments found.

Hello,

I’m currently having some issues trying to embed the retweet, favourite links.

I’ve managed to get the box popping up etc, however I am struggling to fit the code into the website to pull the ID for each tweet.

I noticed you replied to someone in regards to this but the code you provided didn’t work?

<a href="https://twitter.com/intent/retweet?tweet_id={tweet:id_str}"> Retweet </a>

Any help would be much appreciated.

Regards, David

I’ve managed to get this completed!

Hi

How I format the 2 users and 2 hash tags on same feed, Alternative

Hi,

Wondering if it’s possible to load tweets separately. I have the following structure for example:

Something Tweet nr 1 Something Something Tweet nr 2 Something Tweet nr 3 Something

Thanks!

Hi, I am trying to run my first test on your class, and I keep getting this error message: “Parse error: syntax error, unexpected ’:’ in /Social/ultimate-twitter-feed-class/src/ultimate.twitter.feed.php on line 156”.

I was trying the first example from the ‘examples’ page. Can you please help?

Thanks.

Unfortunately this script requires at least 5.3 as stated on the product page.

Are you restricted to that PHP version?

OK, I somehow missed that. I will check and see if I can upgrade – are you sure this is the reason for the error?

Yes I am sure. That line is using a feature that is available starting in PHP 5.3.

Hello,

Thanks a lot for this custom twitter feed, it works really well. I have one request if you can help me with please, how can I make so only the last tweet appear on the feed not the last 5 ?

Thank you for your help.

Hi sjsp,

You can set the count option to 1.

If the changes doesn’t appear, try deleting the cache files.

Hi.

I have just purchased your plugin. I passed iam using this code:

<?php
$options = array(
'screen_name' => 'rothenborg',
'consumer_key'  => 'xxx',
'consumer_secret' => 'xxx',
'user_token' => 'xxx',
'user_secret' => 'xxx',
);
  $twitter = new Twitter($options);
function myCallback($tweet) {
echo $tweet['text'];
}
$twitter->PrintFeed('myCallback');
?>

But i get there two errors :

Warning: strtotime(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /Users/simonrothenborg/Sites/axcelfuture/html/twitter/ultimate.twitter.feed.php on line 251

Warning: strtotime(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /Users/simonrothenborg/Sites/axcelfuture/html/twitter/ultimate.twitter.feed.php on line 477

Can you help? :)

Cannot run this script…

Fatal error: the following errors were reported by Twitter – Could not authenticate you; code 32. on line 573 in …...

Token and secrets are all checked

Enjoying the script, well done. It was a little lean on the setup instructions; didn’t know which files to put the code into. No real biggie, worked it out in the end.

Very nice program! Now, customizing it…

I’d be very grateful if you can help with: What should I change in your “Live Search Ticker” php code in order to use a Twitter List (instead of search results) in your “Live Search Ticker” example? I’m trying to create a “Live Twitter List”.

Thank you! Kevin

php code from your example: list($data, $response) = array($twitter->GetRequestData(), array(‘html’ => ’’));

foreach($data[‘statuses’] as $tweet) { if(bccomp($tweet[‘id_str’], $_POST[‘sinceID’]) !== 1) continue; }

$response[‘html’] .= ‘
  • ‘user’ .’” /> ‘user’ .’”> ’. $tweet‘user’ .’ @ ’. $tweet‘user’ .’ ’. date(‘j M’, strtotime($tweet[‘created_at’])) .’ ’. $tweet[‘text’] .’ ’. ($tweet[‘is_retweet’] ? ‘ Retweeted by ’. $tweet‘retweeter’ .’ ’ : ’’).’
  • ’;

    In Live Search Ticker example code, where can we get/find the “search-ticker.php” file (see below reference)? Or is it automagically included already?

    Trying to get the Live Search Ticker to work. Help! Thx!

    // NOTE: “search-ticker.php” contains the PHP in this example $.post(‘search-ticker.php’, {sinceID: lastID}, function(data) { var results = $.parseHTML(data.html) || [];

    The contents of search-ticker.php are found in section PHP of the example (right below the JS example).

    Now I understood what you meant. Sorry, total misreading… and I’m obviously a noob.

    But, still trying to make it work. It’s returning blanks.

    Returning blank. I just emailed you my details. Please help. I tried repeating the steps multiple times, but must be missing something.

    Thanks.

    resolved.

    Hi Kevin,

    I’m glad that you were able to resolve your issues.

    What was the solution?

    User error (ie, me). Typo.

    Austin—What do I need to do to create feeds from (my) Private Lists on Twitter? I do see the info below regarding normal/public ists. What would I need to modify if the lists are Private (mine). How authenticate myself?

    Thank you! Kevin

    nomadone 11 months ago Flag This looks awesome, is there any way to use this to display a feed from a twitter list instead of manually inserting each user’s username?

    AustinBrunkhorst AustinBrunkhorst AUTHOR 11 months ago Flag Thanks!

    Indeed you can, it’s very simple. You just need to change a few options.

    First, you need to set the request_type to “1.1/lists/statuses”. From there, you need to add the options that Twitter requires. This is slug (the list name), and owner_screen_name (the screen name of the owner of the list).

    For example:

    $options = array( ‘request_type’ => ‘1.1/lists/statuses’, ‘slug’ => ‘minecraft’, ‘owner_screen_name’ => ‘EltonMayfield’ ‘consumer_key’ => ’...’, ‘consumer_secret’ => ’...’, ‘user_token’ => ’...’, ‘user_secret’ => ’...’ );

    Fixed.

    Hi Austin,

    I love the script. I just bought it. Question, does it support tweet, retweet and favorite buttons? If twitter is down does it display the latest cached tweets or an error message?

    Thanks!

    Hi Austin, Are you around? :-)

    I’m around!

    I apologize for the late response. I’ve been recovering from a recent surgery.

    does it support tweet, retweet and favorite buttons?

    The script doesn’t specifically support it, but it can be done extremely easily! Twitter has a thing called “Web Intents” that allow you to embed tweet/retweet/favorite actions on specific tweets. You can find that documentation here.

    An example simply using the format option could be as follows (use this as the format option).

    <p> {tweet:text} </p>
    <p>
        <a href="https://twitter.com/intent/tweet?in_reply_to={tweet:id_str}"> Reply </a>
    </p>
    <p>
        <a href="https://twitter.com/intent/retweet?tweet_id={tweet:id_str}"> Retweet </a>
    </p>
    <p>
        <a href="https://twitter.com/intent/favorite?tweet_id={tweet:id_str}"> Favorite </a>
    </p>

    It is to note that in order for the links to be displayed in a popup window of a reasonable size, you must include the script platform.twitter.com/widgets.js on your page.

    If twitter is down does it display the latest cached tweets or an error message?

    It loads requests from cache first and foremost, so it doesn’t know if Twitter is down. If Twitter is down or the request fails for whatever reason when the cache is updating, then the error will be thrown.

    Now that you mention this scenario, I think it would be best if I made it so in the case the cache is updating and the request fails, it will use the last cache data and silently ignore the errors. If there is no cache data, then the errors will be thrown. I’ll try to have this update out soon! Thanks for pointing it out.

    Great script! Worth every penny!

    Can I limit the number of visible tweats? I want to just show the last 3.

    Hi vendimaan,

    I’m glad you like the script!

    To limit the number of tweets, you can set the option count to whatever number you desire (in your case 3). Note that this will not have effect until the cache is next updated, so if it doesn’t change anything, that’s why.

    You can find the available options for the class here.

    You’ll notice that count is not listed in these options. This is because the class automatically sends options not used by the class (shown in the link above) to the API endpoint that you specify (by default it’s Twitter::RequestTimelineUser). That means that you can use any option that is listed on Twitter’s API documentation. You can find the documentation for Twitter::RequestTimelineUser here (there, you will find count).

    How do I filter out direct tweets?

    What do you mean by direct tweets?

    I am showing all tweets from @user, but it includes tweets he sends to other users. I need to filter those out.

    I figured it out… I am using strip_tags() to remove the HTML from the $tweet[] and then skipping anything with a leading ”@”

    This class/code is fantastic and the support is amazing. I hope you’re considering a similar class for Facebook.

    Thank you for the kind words.

    What did you have in mind for a Facebook class?

    Pretty much the same thing… I’d like to access the posts from a Facebook page and display them MY way and not how Facebook wants them.

    I’ll definitely consider it soon. I was interested in doing that in the very early stages of the Facebook API but I was turned away due to how overly complicated it was. It seems like they’ve listened to the community about this issue so what you suggested is something I would certainly be interested in when I get the time.

    So, to return both users and hash tags.. 'request_type' => 'Twitter::RequestSearch', 'q' => '@user1 @user2 #hash1 #hash2', ?

    I’m not an expert on the Search endpoint, but you can find information about the queries here.

    Additionally, you can test it quickly using the console sandbox here. Just select /search/tweets.json on the left toolbar as that’s what endpoint this class uses.

    Thanks the answer is in using booleans: from:twitterapi OR from:google OR #wicker

    It will return all tweets from both users and any tweet containing #wicker

    Good to know, thanks for the info.

    How do I get the tweets as text instead of using ->PrintFeed() ?

    I’m using this to create my own custom twitter shortcode in WordPress.

    You can either use a callback function in PrintFeed() to access each tweet object (example here), or use GetRequestData() to get the raw request data. You’ll have to iterate through each tweet manually, based on the request endpoint.

    You can find an example using GetRequestData() on the examples page I linked above under Live Search Ticker.

    If you plan on redistributing the WordPress shortcode in another item, you must purchase an extended license.

    Nope, this is strictly for sites owned by the company I work for. No redistribution. And thanks!

    How can I display twitter time from months to days? for example change from “8 months ago” to “257 days ago”. Thanks

    Woops, I forgot a closing parentheses.

    It should be getDays(strtotime($tweet['created_at']))

    perfect. it works now. thank you

    No problem. Glad you were able to get it working.

    Hey Austin,

    Is there a way to get the max_id from a Twitter::RequestSearch? API v1 had the “page” parameter. Now it seems (v1.1) we must get the max_id then submit a new request using since_id.

    I’m trying to get more than 100 results from a search. Am I on the right track, or is there a simpler approach?

    Thanks!

    Yes you are on the right track.

    The class has a method GetRequestData() which returns the raw data for the last request. According to the search endpoint documentation, there is search_metadata field that contains max_id.

    Here’s how you would access that.

    // your class options
    $opts = array( ... );
    
    $twitter = new Twitter($opts);
    
    $data = $twitter->GetRequestData();
    
    // we found her!
    $maxID = $data['search_metadata']['max_id'];
    
    by
    by
    by
    by
    by
    by

    Tell us what you think!

    We'd like to ask you a few questions to help improve CodeCanyon.

    Sure, take me to the survey