Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#229 2013-06-24 09:42:35
Re: TXP Tweet: arc_twitter and arc_twitter_intents
Tweeting a new article has also stopped working for me – arc_twitter v3.3.1, updated from version 2.xx
I get an 410 error as twitter response.
If they changed their api completely, than we can’t patch it quickly or is there a quick solution?
Offline
#230 2013-06-24 16:38:52
Re: TXP Tweet: arc_twitter and arc_twitter_intents
There isn’t a quick solution
I’ve just patched an old version of arc_twitter (v3.0) to work with Twitter’s API v1.1.
I had to patch this v3.0 version as I needed the plugin to work with Txp 4.4.1. (Latest arc_twitter release, v3.3.1, only works on 4.5+).
And I’ve also “backported” (foreported?) my changes to v3.3.1. I haven’t been able to test this “backport”.
So, for anyone that would like to help testing this patched version, here is the code: arc_twitter_v3.3.1_patched.php
Just copy the code and replace the full code on your plugin installation.
Please, give feedback if it worked, or if it didn’t. :)
Offline
#231 2013-06-24 17:05:59
Re: TXP Tweet: arc_twitter and arc_twitter_intents
For those interested in the technical side, here is the diff
Basically, starting with Twitter API v1.1, all API responses are in JSON format.
That badly broke arc_twitter, as the whole plugin was prepared to work with XML responses.
So, I’ve gone thru the code, and:
- looked for all the instance of the arc_twitter object and modifying them to also pass the OAuth
accessToken
andaccessTokenSecret
. - looked for all the requests to Twitter REST API and changed them accordingly.
- changed how the code accessed the fields (a.k.a. properties) of the response objects.
- updated Abraham’s Twitter OAuth library and PHP OAuth library.
I think that’s all.
Offline
#232 2013-06-24 19:16:07
- protennisjobs
- New Member
- Registered: 2013-01-02
- Posts: 6
Re: TXP Tweet: arc_twitter and arc_twitter_intents
Hey Julian. Thanks for looking into this matter and working out a fix. Was hoping someone would soon. I tried your code and it seems to work. After publishing my an article it did successfully auto post to twitter, however after submitting articles I am getting this error code:
Fatal error: Cannot use object of type stdClass as array in /home/protenni/public_html/textpattern/lib/txplib_misc.php(653) : eval()’d code on line 1035
Any idea on this? Thanks again
Offline
#233 2013-06-24 22:07:19
Re: TXP Tweet: arc_twitter and arc_twitter_intents
protennisjobs et al,
I’ve upgraded the gist: gist.github.com/maniqui/5851399
I think this one should fix protennisjobs’ issue.
@everybody,
I’ve also done this change:
@@ -493,7 +495,7 @@
$sql = "CREATE TABLE IF NOT EXISTS ".PFX."arc_twitter ";
$sql.= "(arc_twitterid INTEGER AUTO_INCREMENT PRIMARY KEY,
article_id INTEGER(11),
- tweet_id BIGINT(20),
+ tweet_id VARCHAR(100),
tweet VARCHAR(140),
tinyurl VARCHAR(30));";
As you can see, I’ve changed the tweet_id
column from BIGINT
to VARCHAR
.
That column is there to record the id
(as provided by Twitter) of a tweet. Today, a tweet id
could be a really big number, like, for example, 3456789123456789
.
The problem was that BIGINT
cannot store an integer greater than 2147483647.
So I modified the column to be VARCHAR
of 100 digits. I think there is plenty room of space there for a few years (centuries?) of tweets.
So, for those who are concerned by this change, you can just log in into your database (for example, using phpmyadmin or adminer) and alter that column on the arc_twitter
table, to be a VARCHAR
table.
You will probably see that all the rows in your table have the 2147483647 (twitpocalypse number). :)
Once you patched the code & manually altered the table, you can check the table again and you will see that the proper tweet id
is stored.
Offline
#234 2013-06-25 10:06:53
Re: TXP Tweet: arc_twitter and arc_twitter_intents
@maniqui
works perfectly with your patched version, also on textpattern 4.4.1
Thanks a lot!!
Hope that Andy integrates your patch soon in the “official” version
Offline
#235 2013-06-25 11:44:13
Re: TXP Tweet: arc_twitter and arc_twitter_intents
@maniqui, Thanks for updating that plugin; it seems to work perfectly on my 4.5.4 install..
Offline
#236 2013-06-25 14:52:41
Re: TXP Tweet: arc_twitter and arc_twitter_intents
whocarez, carlahearne, thanks for the feedback.
I’ve applied two more fixes, available in the updated gist
- the “delete tweet” (a X next to the tweet) functionality on “Twitter” tab was broken. Now it’s fixed. Take into consideration that when deleting a tweet from within TXP interface, it will still show there in the list, as that list is cached. But rest assured that it will be deleted from Twitter (you can confirm by visiting your timeline after deleting a tweet).
- there was a bug on the “Options” tab for the plugin, on the suffix field. The suffix was correctly saved in the database, but the interface showed the contents for the prefix field on both fields, and on a second submit, it would eventually overwrite the value. Now it’s fixed.
@everyone: a user reported that this patch didn’t worked for her until she deleted the plugin and did a clean re-install of original arc_twitter v3.3.1, and only after that, applied the patched version.
Offline
#237 2013-06-25 17:04:38
- protennisjobs
- New Member
- Registered: 2013-01-02
- Posts: 6
Re: TXP Tweet: arc_twitter and arc_twitter_intents
The code seems to be working perfect for me now without any errors. Thanks a bunch Julian!
Offline
#238 2013-06-26 05:49:07
Re: TXP Tweet: arc_twitter and arc_twitter_intents
Is the <txp:arc_twitter user="username" limit="5" wraptag="ul" break="li" dateformat="%b %Oe, %I:%M %p" />
still working or do I just have something messed up?
I have maniqui’s new code running and I can connect to Twitter, see my posts in the extensions tab, create a new post, but simply showing the feed doesn’t seem to be working.
Offline
#239 2013-06-26 15:42:41
Re: TXP Tweet: arc_twitter and arc_twitter_intents
Hi visualpeople.
I’ve just tested it and it worked for me.
Some stuff to try:
- delete temp files from
textpattern/tmp
. My bet is that you have some cached responses there, that were cached before you patched the plugin. - set the website to “Testing” and check if there is any error message on the output.
@everyone:
I’ve updated the gist with a new fix.
https://gist.github.com/maniqui/5851399
The fix: corrected the API URLs for home_timeline
and mentions_timeline
Offline
#240 2013-06-26 18:24:22
Re: TXP Tweet: arc_twitter and arc_twitter_intents
Thanks for the advice — I’ll keep testing. Cleared the temp files and still no go. It must be something on my end. I tried on two different installations, I just realized both are running 4.4.1, though, so I’ll try on a current install. I’m getting the error Tag error: <txp:arc_twitter user="visualpeople" limit="5" wraptag="ul" break="li" dateformat="%b %Oe, %I:%M %p" /> -> Textpattern Warning: tag does not exist on line 1202
Tried on 4.4.1 and 4.5.4 installs both with the username connected and not. Weird. I’ll keep troubleshooting…
Last edited by visualpeople (2013-06-26 18:25:25)
Offline