This is the website of Andy Carter a Textpattern and Drupal web developer living in the Steel city.
arc_twitter provides access to your Twitter account through both the admin interface and the public side of your site. Update Twitter when you post a new article (with article-by-article opt out option), update and view your Twitter feed through the admin Twitter tab, and display Twitter feeds on your site.
Requirements:-
To install go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin.
Before you start using arc_twitter you will need to make sure that the cache directory is writable. See the ‘Caching’ subsection below for further information.
arc_twitter should now be ready for use on the public-side of your site.
To unlock the admin features of this plugin you will need to associate your site with a Twitter account by connecting to Twitter from the plugin’s options screen. Click on the link to connect to Twitter, you will be asked to login to Twitter, clicking this link will temporarily take you to the Twitter site where you will be asked to login and approve access for TXP Tweet to read and write to your Twitter account. If all is successful you will be returned to the options screen and your user name will appear.
At any time you can disassociate your Twitter account with TXP Tweet via your Twitter account preferences on the Twitter website.
To uninstall arc_twitter simply delete the plugin from the ‘Plugins’ tab. This will remove the plugin code, delete related preferences and drop the arc_twitter table from your Textpattern database.
To uninstall arc_twitter simply delete the plugin from the ‘Plugins’ tab. This will remove the plugin code, delete related preferences and drop the arc_twitter table from your Textpattern database.
<txp:arc_twitter user="drmonkeyninja" />
| Attribute | Description | Default | Example |
|---|---|---|---|
| user | Twitter user name | unset | user="drmonkeyninja" |
| password | Your Twitter password (not required for public updates) | unset | |
| limit | Maximum number of tweets to display (max. 200) | 10 | limit="25" |
| dateformat | Format that update dates will appear as | Archive date format | dateformat="%b %Oe, %I:%M %p" |
| label | Label for the top of the list | no label | label="My Twitter timeline" |
| labeltag | Independent wraptag for label | unset | labeltag="h3" |
| break | HTML tag (without brackets), or string, used to separate the updates | li | break="br" |
| wraptag | HTML tag to be used as the wraptag, without brackets | unset | wraptag="ul" |
| class | CSS class attribute for wraptag | arc_twitter | class="twitter" |
| class_posted | CSS class attribute applied to span tag around posted date | arc_twitter-posted |
<txp:arc_twitter_search hashtags="txp" />
| Attribute | Description | Default | Example |
|---|---|---|---|
| search | Comma separated list of search words | unset | search="txp,textpattern" |
| hashtags | Comma separated list of hashtags to search for (not including the hash) | unset | hashtags="txp,textpattern" |
| reply | Username of tweets in reply to | unset | reply="twitter" |
| mention | Username of user mentioned in tweets (i.e. tweets containing @username) | unset | mention="twitter" |
| limit | Maximum number of tweets to display (max. 200) | 10 | limit="25" |
| dateformat | Format that update dates will appear as | Archive date format | dateformat="%b %Oe, %I:%M %p" |
| label | Label for the top of the list | no label | |
| labeltag | Independent wraptag for label | unset | |
| break | HTML tag (without brackets), or string, used to separate the updates | li | |
| wraptag | HTML tag to be used as the wraptag, without brackets | unset | |
| class | CSS class attribute for wraptag | arc_twitter_search | |
| class_user | CSS class attribute applied to span tag around user name | arc_twitter-user | |
| class_posted | CSS class attribute applied to span tag around posted date | arc_twitter-posted |
<txp:arc_twitter_search search="plugin" hashtags="txp,textpattern" limit="25" />
Produces a list of tweets containing the word ‘plugin’ and the hashtags ‘#txp’ and ‘#textpattern’. The tag will return a maximum of 25 tweets.
In order to prevent excessive repeatitive calls to the Twitter website it is recommended to cache results. Twitter limits the number of calls through the API, and continuous calls will result in Twitter closing to further requests. By default, arc_twitter caches for 30 minute intervals.
| Attribute | Description | Default | Example |
|---|---|---|---|
| caching | ‘1’ to cache feed, ‘0’ to turn caching off (not recommended) | 1 | caching="1" |
| cache_dir | Absolute path to the cache directory (must be writable) | ||
| cache_time | Time in minutes that the cache files are stored before being refreshed | 5 | cache_time="30" |
The admin side of this plugin enforces caching, apart from when it is posting to Twitter (e.g. when posting or deleting an update).
You can access the plugins core preferences from either the Preferences or Plugins tabs in admin. Setup your Twitter account login details (i.e. your username and password) and change the cache directory using arc_twitter’s preferences. Without providing your account login details the admin area features of this plugin will be inactive.
You can select the URL shortener method you want to use to link back to your article on Twitter. Please note that if you select smd_short_url you will need to have installed and activated the smd_short_url plugin developed by Stef Dawson.
If you set your Twitter account username and password you will see the option to update Twitter everytime you create a new article. By default arc_twitter will post an update to Twitter including a shortened URL to your article. Only live and active articles will be sent to Twitter, i.e. articles posted in the future or as sticky articles will not be sent. If your article is successfully submitted to Twitter the update will appear in place of the Twitter option on the right-hand-side of the article edit screen.
Tweets are sent in the following format: Tweet prefix Article title Shortened URL Tweet suffix. You can change the prefix and suffix on an article-by-article basis by changing the tweet options under ‘Update Twitter’ on the article editor screen. The default Tweet prefix can be set under the arc_twitter preferences screen (the default on installation is “Just posted:”).
Please note that once an article has been tweeted the tweet cannot be edited.
Under the Extensions tab (this can be changed from the plugin’s preference page) a new Twitter tab should appear once you have connected your site to your Twitter account. From here you will be able to submit new Twitter updates, view basic account statistics, and check out your recent updates (including the option to delete your tweets).
Nice Plug in! Like the fact you can tweet from the admin, do you have any future features planned? Things like – limit the amount of tweets shown? – Reply link
— Oliver Ker · Fri Dec 4, 03:14 PM
Hi Oliver, glad you like the plugin. Slight mistake on my behalf when writing the documentation for the plugin; you can already limit the number of tweets shown using the limit attribute (up to a maximum of 200). I’m actually finding that at times Twitter is playing up and not returning the complete set of tweets, so the limit works more as a maximum than an actual number of tweets.
I have loads of new features planned. I’m currently working on some new public-side tags including one to make use of Twitter’s search methods. There are also plans to build upon the admin side of things. I’m taking suggestions and adding them to my list of things to do.
My overall aim is to make arc_twitter the complete Twitter solution for Textpattern.
— Andy · Fri Dec 4, 08:45 PM
…oh, I notice that you are a fellow Yorkshireman! Nice website.
— Andy · Fri Dec 4, 08:46 PM
Good stuff, what about the retweet button like wordpress for readers?
Didn’t realise ur were so close! My mrs is from your neck of the woods, they are all ‘Blades’.
Look forward to what else you come up with.
— Oliver Ker · Sun Dec 6, 07:36 PM
Hi Andy, just wondering:
1. what type of url shortening your plugin uses? I am using Stef’s smd_short_url plugin on my site, which produces urls in the format: site.com/article_ID. I’d like to provide the links in this format if possible.
2. how the articles are truncated to Twitter’s 140 character limit? Is it possible to optionally instruct your plugin to accept the excerpt as the text (where the excerpt text is less than or equal to 140 characters, naturally)?
— speeke · Tue Dec 15, 01:54 AM
Good day! Unfortunately arc_twitter plugin makes not correct URL for article if I change it’s URL in input. Is it possible to repair this bag? Thank you!
— Andrey · Fri Dec 18, 06:04 PM
Great update, thanks.
— Oliver Ker · Thu Jan 28, 09:10 AM
Love your arc_twitter plugin… It would be cool to have the ability to put the date on it’s own line if possible?
Also, I’m experiencing a blank screen on the live site not sure why? I have to turn the plugin off for a few mins. Any ideas?
Keep up the good work Andy.
— Craig Valadez · Sat Jan 30, 09:48 PM
Hi Craig,
Glad you like arc_twitter; I’m enjoying developing it.
I’m somewhat of a XHTML markup minimalist and like to let users play with the styling as much as possible through the CSS. The dates should all be output in span elements that you could style to a new line in the CSS. Having said that I just checked the markup produced by the new arc_twitter_search tag and realised that I have forgotten to apply classes to the spans to distinguish between the date and user spans. I’ll make sure that gets covered in the next update.
As for the blank screen I have never seen that happen before. Is it preventing the page to render completely? If your site is in live mode could you temporarily switch it to test mode to see if any errors are being generated?
— Andy · Sun Jan 31, 06:22 PM
Hi, is it possible to use this plugin for Identi.ca which has a Twitter compatible API?
— Aion · Fri Feb 5, 06:43 PM
Hi Aion, I’m not familiar with Identi.ca (although it was briefly talked about in our office last week). I’ll take a look at the API documentation and see how similar it is to Twitter’s API. If it is simply a change in the base URL of the request then possibly it would be worth enabling arc_twitter to work with both services.
— Andy · Mon Feb 8, 06:32 PM
Hey Andy
Is this easily explainable?
Loaded Plug-in
Inserted Twitter name and password.
then this:It come up when I click on the twitter tab or the plug-in preferences.
Fatal error: Uncaught exception ‘Exception’ with message ‘PHP extension cURL is not loaded.’ in [content removed]
— Les Smith · Tue Feb 9, 11:46 PM
Hey Andy could you please delete the significant part of that message as i didn’t redact part of that message when asking for help.
— Les Smith · Tue Feb 9, 11:51 PM
And I solved it by enabling curl on the PHP server, Andy please delete the first post or redact everything after the first error line.
Thanks
— Les Smith · Wed Feb 10, 01:10 AM
vote +1 for identi.ca/StatusNet support.
For technical details & help regarding the API please address @evan, the StatusNet boss, on identi.ca.
— Markus Merz | Hamburg St. Georg · Tue Mar 16, 11:10 AM
Hi Andy,
Lovin’ the plugin. I’m running in to a situation where if someone is behind a firefall or their company is blocking twitter, then my whole site times out and becomes inaccessible. Is there anything built in that would just display a, “Could not connect to Twitter” type message in place of the tweets?
Thanks!
— Joe · Fri Mar 26, 03:55 PM
Hi Joe,
If I remember correctly I did include a timeout parameter in the behind-the-scenes code for the plugin. It is not currently accessible for change through the plugin though. I will look into it as if you were able to lower this value then rather than the site timing out users would see the cached version of the feed.
Out of interest do you know how long your server will execute a page before timing out?
— Andy · Mon Mar 29, 06:29 PM
This is partly a personal note, but there are a couple of issues that I am aware of and am working on with arc_twitter.
1. MySQL “ALTER TABLE” error on fresh install needs sorting. The alter process is to be removed from the plugin. If you’re experiencing this it shouldn’t affect the install, it is more of a warning than an error.
2. Some XML load failures are occurring with the arc_twitter tag at times. Seems like when the XML from Twitter is incomplete it pulls the plugin down and caching really screws things up. I’m marking this issue as a priority.
— Andy Carter · Mon Jul 19, 07:52 PM
The two issues mentioned above should now both have been fixed (v1.0.3beta). However, as a result support for upgrading from v0.2.1 or earlier has been dropped as of v1.0.3beta. Please make sure that if you are upgrading from an old version that you first install v1.0.2beta before making future upgrades otherwise your arc_twitter database table will not be correct and won’t store all the information needed for some features of TXP Tweet.
Thanks to Ryan on the TXP forums the hashtag linking issue has now also been resolved.
— Andy Carter · Sat Jul 24, 10:55 AM
About Twitters that doesnt use tinyurl o bitly… If you add the URL in this way: http://www.site.com/news.php?nid=155979, you will observe a broken link, this is because next to the “?” character the link format is interrupted.
— Norman F. · Sat Jul 24, 10:31 PM
Is There a way to add an avatar to arc_twitter to every user?
— Tim R. · Sun Jul 25, 06:38 PM
@Norman: thanks for pointing out that linking issue I will try and get that sorted for the next release. Shouldn’t be too much of an issue to fix.
@Tim: the plan is to look into making big improvements to the arc_twitter and arc_twitter_search tags for the next big release of the plugin (plus new tags). As part of that I will try and look into adding the ability to display avatars.
I have considered this before, but as I recall it wasn’t straightforward and I hadn’t decided the best way of implementing it. However, my current line of thought on the plugin should make all of this make sense. Watch this space!
— Andy Carter · Mon Jul 26, 12:11 PM
Hi.
Thanks for your plugins!
I was using “arc_twitter_search”, but there is a problem using “limit”, always shows “15” tweets, no matter if i add, for example, limit=3”. I was trying to modified your code, but i dont understand very well some functions.
Do you have an idea what can i do?
:(
If you can write me to my email i will really appreciate!
— José · Tue Jul 27, 03:57 AM
Hi José, the limit has been fixed as of v1.0.4.
— Andy Carter · Sun Aug 8, 04:35 PM
Hey thank you for your plugin!
I want to ask you something, how do you change the date format to get something like ““xx hours/minutes ago”?
Thanks again!
— Arturo Ryes · Fri Sep 24, 11:37 PM
Is there any hacks to make this work with 4.0.7? For reasons mostly due to time, we aren’t able to update to 4.2+.
I found out 4.0.7 doesn’t support options in the plugin screen, but I was able to figure out the URL and the plugin configured correctly.
Is there anything else I need to do to make it work?
I notice there is a tweet option missing from the write screen.
Please let me know since 4.2 doesn’t work with all my code.
— Shige Abe · Tue Sep 28, 08:46 PM
Hi Andy,
After installing the plugin I get the following error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/vhosts/zeilschoolblauwestad.nl/httpdocs/textpattern/lib/txplib_misc.php(484) : eval()‘d code on line 661
And plugin_prefs are not available..
Do you know what’s wrong and how I can fix it?
Thanks!
— Thijs · Sat Oct 2, 01:24 PM
Nice plugin, but the latest version does not work with a multi-site textpattern setup. The link in the settings (Connect to Twitter) seems to have some hard-coded parts in the URL (it adds the textpattern/index.php part that doesn’t work with a subdomain multi-site install). The old 0.2.4 worked great in that setup, though.
Txp 4.2.0, arc_twitter 1.0.4
— Stephan · Fri Oct 15, 08:02 PM
@Shige, I’m afraid arc_twitter needs to be run on TXP 4.2 or higher as it uses a number of features that weren’t previously available. With newer versions of TXP coming out there is no motivation to make it backwards compatible.
@Thijs, I would try uninstalling, downloading the plugin and installing again to see if the problem clears, seems like the plugin didn’t download properly the first time.
@Stephan, there are issues (at the moment) with multisite installs that I haven’t had chance to rectify yet. maniqui has suggested (over on the TXP forums) this temporary fix which can be added to your .htaccess file:-
Redirect 301 /textpattern /admin
The difference between the version 1 and earlier versions is a Twitter change to their API which was unavoidable. I tried my best to ensure people could continue using arc_twitter after this happened, but my free time is very short.
— Andy Carter · Thu Oct 21, 05:58 PM
This is a great plugin. I’m having a bit of an issue though. Install/setup/connecting all went ok. But publishing an article doens’t twitter immediately. After clicking Publish the Update Twitter swiches from Yes to No. I have to put it on Yes again and update the article to twitter.
I’m using txp4.2, arc_twitter 1.04, smd_short_url 0.21
Any suggestions on a fix?
— Jelle · Thu Nov 11, 10:35 PM
Hi Jelle, sounds like an issue with the article post date. arc_twitter won’t update Twitter if an article is being posted in the future. Are you by any chance checking “Set timestamp to now…”? I have a feeling that sometimes causes arc_twitter to treat the post as set in the future. This is something that I need to investigate further.
As for the Yes/No switching to ‘No’ after saving, that is a consequence of using TXP’s yes/no function to produce the radio buttons; I am planning on moving away from this in future.
— Andy Carter · Mon Nov 15, 12:06 PM
You have really gone to town on this. Great work, thank you!!! It’s plugins like this that keep me coming back to TXP
— Peter Jacobson · Mon Nov 22, 05:36 AM
I downloaded arc_twitter.txt, I got the message on Txp:
“Defective or empty plugin code”
— psychoMUELL · Sat Mar 5, 10:42 AM
@psychoMUELL – sorry, the plugin hadn’t compiled properly. I’ve uploaded the correct file so it should work now.
— Andy Carter · Sat Mar 5, 03:10 PM
Thanks :-)
— psychoMUELL · Sat Mar 5, 03:26 PM
how can I show in my blog a RT?
— psychoMUELL · Thu Mar 17, 03:30 PM
Hi psychoMUELL, not sure exactly what you are wanting to do.
You can use the <txp:arc_twitter_retweet /> tag to add a Twitter button to your page for people to share the link.
<txp:arc_twitter_tweet /> will output the current article’s Twitter update (think that might have been forgotten in the documentation so I will look into adding it).
— Andy Carter · Mon Mar 21, 08:45 PM
Hi Andy
in your sidebar I see this sign : ♺
you get the automatic with an RT?
— psychoMUELL · Mon Mar 28, 06:43 AM
Hi psychoMUELL,
That symbol comes from my desktop Twitter client Gwibber when I retweet. It should be possible to include with retweets from arc_twitter though by defining the text attribute for arc_twitter_retweet.
If you want retweets from Twitter showing in your arc_twitter output you will also need to include the attribute retweets=“true”.
— Andy · Mon Mar 28, 01:13 PM
Thanks a lot :-)
— psychoMUELL · Tue Mar 29, 09:09 AM
For some reason your Plug-In stopped working for me. I run into timeouts, Tweets for new Articles are not being sent and while trying to re-register I get these Error-Messages:
Notice: Undefined index: oauth_token in /[…]/textpattern/lib/txplib_misc.php(594) : eval()‘d code on line 1016
Also, Twitter us complaining about the Token already being used – but I guess that is Ok.
Let me know what I can do to help you looking into this!
— Kai · Sun Sep 11, 02:52 AM
@Kai, a number of people have been reporting this lately. It seems to be a problem with the Twitter server being inaccessible and usually works if you try again a little later. I’ve not seen a problem with Twitter complaining about a token already being in use before, that’s a little strange.
— Andy · Mon Sep 12, 06:26 PM
I’m not sure what I’m doing wrong. The plugin is installed and is obviously connecting to Twitter correctly – I can see my tweets in the Extensions/Content area. BUT I get no output from the tag at all, it doesn’t even show the label. This is the tag I’m using;
<txp:arc_twitter user=“baldrick1971” limit=“5” label=“Twitter” labeltag=“h1” wraptag=“ul” break=“li” />
Any thoughts?
— Matt · Wed Nov 9, 08:31 PM
@Matt, you do not need to include the “user” attribute in the tag if it is the same as the one you connected Textpattern to. The tweets for baldrick1971 appear to be private which might be the cause of the issue. Try removing the “user” attribute and see if that fixes your problem. If not I’ll take a look at the code and see if there is a bug relating to private Twitter accounts.
— Andy · Sat Nov 12, 11:17 AM
@Andy – dropping the user tag didn’t make a difference. I unprotected my tweets as a test and that solved the problem – so it does look like there is an issue with protected tweets. Thanks for the pointer.
— Matt · Tue Nov 15, 02:32 AM
@Matt, thanks for checking. I’ve added it as an issue to the issue list on Github and will attempt to solve this.
— Andy · Tue Nov 15, 06:29 PM
When i add the tag to my site (www.kangyunchen.com/textpattern) i get the following error msg:
Tag error: <txp:arc_twitter limit=“5” wraptag=“ul” break=“li” dateformat=”%b %Oe, %I:%M %p” /> -> Warning: file_put_contents(/www/textpattern/textpattern/tmp/d3ab1ed77f45169c70c10d3dbb3897f4) [function.file-put-contents]: failed to open stream: No such file or directory on line 1127
i made the textpattern/tmp and textpattern/lib directories read and write accessable but to no avail. i tried adding this plugin to another site i’m working on for a client and i get this same issue. what am i doing wrong?
— Nicholas Chen · Tue Nov 29, 05:12 PM
@rockyrock, as far as I am aware mem_twitter will only let you opt in or out of posting to Twitter per section. arc_twitter lets you decide per article. arc_twitter also adds an optional Twitter tab for posting general updates to Twitter. Plus it adds a load of tags for using on your site for fuller Twitter integration.
@Nicholas, it looks like your tmp directory path is wrong – you have two references to the textpattern directory; is that correct? Check the Textpattern forums as several others have had similar issues that they were able to resolve.
— Andy · Sun Dec 4, 06:34 PM
Hi there. Any reason arc_twitter randomly doesn’t output anything?
Code:
<txp:arc_twitter user=“rossharvey” dateformat=”%d/%m/%y” limit=“5” wraptag=“ul” break=“li” class=“icon chat twitter” />
Using it on the homepage, and it’s being inconsistent, which doesn’t look very professional!
Thanks,
Ross
— Ross · Thu Feb 2, 05:05 PM