6

Accomplished this by setting the get request url, then passing it into tweets: {% set handle = entry.twitterHandle %} {% set url = 'statuses/user_timeline.json?screen_name=' ~ handle ~ '&count=3&exclude_replies=true' %} {% set tweets = craft.twitter.get(url) %} Hope this helps someone else. Thx!


4

There should actually be a entities.media property available in the JSON, when there are images attached to the tweet. This is what works for me: {% set tweets = craft.twitter.get('statuses/user_timeline') %} {% for tweet in tweets %} <li> <p>{{ tweet.text }}</p> {% if tweet.entities.media is defined %} {%...


2

Pretty sure PHP is interpreting that string as an int. Doing a var_dump on the variable shows int(596249628892364800). That's pretty much PHP's type casting at work. While you could cast the variable as a string, there's actually an unused variable called id_str which is ideal to use. Edit the file twitter\fieldtypes\Twitter_TweetFieldType.php. Replace ...


2

While we wait for an official update, you can patch this pretty easily. Just open up craft/plugins/twitter/TwitterPlugin.php and find this function: public function getSettingsHtml() { // ... } Delete the function entirely, and replace it with this: public function getSettingsUrl() { return 'twitter/settings'; }


2

I've tested this works on my install: {% set tweets = craft.twitter.get('search/tweets', {q:'#craftcms'}) %} {% for tweet in tweets.statuses %} {{ tweet.text }} {% endfor %} Have you tried running a {{ dump(tweets) }} to see what you get?


2

Further to Adam's answer, and for everyone else who is reading this question, there is a Craft plugin that can do the date calculation logic, as well as providing more readable timestamps: https://github.com/blue-mantis/BM-Time-Ago-In-Words. As well as '...days ago' it extends into weeks and months, which may not be as useful in this scenario but could ...


2

Great! Thank you @techgyver Here is my final code: {% for tweet in tweets %} {% set tweetDate = date(tweet.created_at).diff(now).format('%a') %} {% if tweetDate == 0 %} {% set tweetTimeAgo = 'today' %} {% else %} {% set tweetTimeAgo = tweetDate ~ ' days ago' %} {% endif %} <div class="tweet-time">{{ tweetTimeAgo }}</...


2

You can use the date method for creating a date object. e.g.: {% set tweetDate = date("Fri Sep 02 14:42:42 +0000 2016") %}


2

Craft's built-in transform functionality doesn't support transforming external URLs. You could use my Imager plugin to do this instead. EDIT: Based on your example, you'd use Imager something like this: {% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %} {% if response.success %} {% for tweet in ...


2

The return from craft.twitter.get() is not an array of tweets, but a response object, where the actual tweets are nested in an attribute called data. Not tested, but from looking at the plugin docs, something like this should do it: {% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended' }) %} {% if response.success %} {% ...


1

This is what the function currently does public function tweetButton($options = []) { $dataAttributes = $this->getOptionsAsDataAttributes($options); $html = '<a class="twitter-share-button" href="https://twitter.com/share"'.$dataAttributes.'>Tweet</a>'; return $html; } So it returns an a tag rather than a link. You should ...


1

I have used it like this. You can find the documentation for most fields on Twitter. Truth be told, the DUKT documentation is not too transparent. {% set tweets = craft.twitter.get('statuses/user_timeline', { user_id:'', count: 10, trim_user: false }) %} {% if tweets %} <ul class="tweet__list"> {% for tweet in tweets %} <li"> ...


1

I actually had to make this same change to the OAuth part of this plugin at craft/plugins/oauth/OauthPlugin.php


1

It was indeed missing files, as suggested by Alec and Benjamin. All down to some non-specific .gitignore rules that meant it was ignoring all "src" folders - which is one of the folders created by the composer install Thanks for your help guys!


Only top voted, non community-wiki answers of a minimum length are eligible