arc_twitter (TXP Tweet)

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.


  • Textpattern 4.5+ (v3.3+)
  • PHP 5 and cURL


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.

The arc_twitter tag


<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"
full_urls 1 to display full URLs, 0 for URLs 0
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

The arc_twitter_search tag


<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"
full_urls 1 to display full URLs, 0 for URLs 0
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
Example usage

<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.

Tweeting articles

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.

The Twitter tab

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).

The Details


  1. Oliver Ker |

    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

  2. Andy |

    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.

  3. Andy |

    …oh, I notice that you are a fellow Yorkshireman! Nice website.

  4. Oliver Ker |

    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.

  5. speeke |

    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: 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)?

  6. Andrey |

    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!

  7. Craig Valadez |

    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.

  8. Andy |

    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?

  9. Aion |

    Hi, is it possible to use this plugin for which has a Twitter compatible API?

  10. Andy |

    Hi Aion, I’m not familiar with (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.

  11. Les Smith |

    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]

  12. Les Smith |

    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.

  13. Les Smith |

    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.


  14. Markus Merz | Hamburg St. Georg |

    vote +1 for support.

    For technical details & help regarding the API please address @evan, the StatusNet boss, on

  15. Joe |

    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?


  16. Andy |

    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?

  17. Andy Carter |

    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.

  18. Andy Carter |

    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.

  19. Norman F. |

    About Twitters that doesnt use tinyurl o bitly… If you add the URL in this way:, you will observe a broken link, this is because next to the “?” character the link format is interrupted.

  20. Tim R. |

    Is There a way to add an avatar to arc_twitter to every user?

  21. Andy Carter |

    @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!

  22. José |


    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!

  23. Andy Carter |

    Hi José, the limit has been fixed as of v1.0.4.

  24. Arturo Ryes |

    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!

  25. Shige Abe |

    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.

  26. Thijs |

    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/ : eval()‘d code on line 661

    And plugin_prefs are not available..

    Do you know what’s wrong and how I can fix it?


  27. Stephan |

    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

  28. Andy Carter |

    @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.

  29. Jelle |

    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?

  30. Andy Carter |

    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.

  31. Peter Jacobson |

    You have really gone to town on this. Great work, thank you!!! It’s plugins like this that keep me coming back to TXP

  32. psychoMUELL |

    I downloaded arc_twitter.txt, I got the message on Txp:
    “Defective or empty plugin code”

  33. Andy Carter |

    @psychoMUELL – sorry, the plugin hadn’t compiled properly. I’ve uploaded the correct file so it should work now.

  34. psychoMUELL |

    how can I show in my blog a RT?

  35. Andy Carter |

    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).

  36. psychoMUELL |

    Hi Andy

    in your sidebar I see this sign : ♺
    you get the automatic with an RT?

  37. Andy |

    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”.

  38. Kai |

    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!

  39. Andy |

    @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.

  40. Matt |

    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?

  41. Andy |

    @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.

  42. Matt |

    @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.

  43. Andy |

    @Matt, thanks for checking. I’ve added it as an issue to the issue list on Github and will attempt to solve this.

  44. Nicholas Chen |

    When i add the tag to my site ( 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?

  45. Andy |

    @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.

  46. Ross |

    Hi there. Any reason arc_twitter randomly doesn’t output anything?


    <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!


  47. Andy |

    Hi Ross,

    I’ve never experienced this problem. The plugin stores a cache of the Twitter feed which should ensure that there is always something to show. The only exception is if all the feed contains retweets and you have not set retweets=“1” as Twitter will deduct them from the limit. So if you fetch 5 tweets and they are all retweets then there will be no output (that’s how Twitter works, not arc_twitter). I am putting together plans to get round this issue.

  48. Matt |

    Hi Andy,

    Would it be possible to add an attribute that would let me add target=’_blank’ to any links in the tweets? It would be great to click on the links and not have my site close down.


  49. Andy |

    Hi Matt,

    arc_twitter doesn’t doing anything with the tweets it receives from Twiiter, it just outputs them. target=”_blank” is also a deprecated attribute. You can achieve what you are looking for already though by using JavaScript. This is easy to to do using jQuery. For example:-

    $(document).ready(function(){ $(’.arc_twitter a’).click(function(e){ e.preventDefault();$(this).attr(‘href’),‘new’); });

  50. Matt |

    Thanks Andy – great advice :)

  51. Janet Chui |

    I was playing with a new installation of TXP and this plugin when I noticed the arc_twitter isn’t working as well for me this time around. (I had to re-do things a few times to get it to recognise my Twitter account, for one. Now that I have that configured, I keep getting this error msg: “<txp:arc_twitter user=“marrael” /> -> Warning: file_put_contents([…long URL that would rec your page layout …]) [function.file-put-contents]: failed to open stream: No such file or directory on line 871”
    which can be seen at at the mo. Any help? The uninstall and re-installing trick isn’t working anymore.

  52. Matt |

    Hi – the download links aren’t working :(

  53. Jeff |

    Thank for this plugin and it has worked great up until the point I installed the newest version of Textpattern (4.5.1). The plugin no longer works. Are there modifications I need to make to get this to work again?

    I’ve tried reinstalling but I’ve had no luck.

  54. Andy |

    Sorry folks. For some reason the files have been lost on the server. I will attempt to repair things here but in the meantime you can download the latest arc_twitter plugin from Github.

    I'm aware that there is a problem with arc_twitter on the latest version of Textpattern. I will investigate as soon as possible, but currently my time is short. Any developments will be posted via Twitter

  55. |

    arc_twitter doesn’t doing anything with the tweets it receives from Twiiter, it just outputs them. target=”_blank” is also a deprecated attribute. You can achieve what you are looking for already though by using JavaScript. This is easy to to do using jQuery. For example:-

    $(document).ready(function(){ $(’.arc_twitter a’).click(function(e){ e.preventDefault();$(this).attr(‘href’),‘new’); });

  56. melissa |

    Hi. I’ve been using this Plugin for over a year and it’s been BRILLIANT. However, with Twitter deprecating 1.1 of its API this week, the plugin stopped working for me. So I came here, upgraded it to 3.3.1, and it still didn’t work. There I saw it required the newest version of TextPattern, so I upgraded it all to TXP 4.5.4 this morning. And it STILL doesn’t work! All the fields and my preferences are there correctly, but if I go to a live article (that hasn’t already been tweeted), set it to Yes, and update the article, I get a notice that the article has been posted, but the Twitter portion of the Article view doesn’t update at all (it used to show the short URL after it had posted), and I don’t see it in my Twitter feed. I’ve tried rec-connecting to my twitter account, and it hasn’t had any effect.

    Can you please advise? Can you confirm, first of all, that you’ve updated this plugin to work with Twitter’s new API version?

    If you could CC any replies to my email, it’d be appreciated.

    thanks very much for creating this plugin in the first place. It shows how great it is that I’m lost without it for a day already!


    (Also, the plugin’s Twitter tab has never worked no matter what version I’m on – Options tab is fine, but Twitter is just a completely blank page).

  57. Andy |

    @Melissa, try v4+ of the plugin all should work now.

  58. Mark |

    Would it be possible to have pictures and videos display rather than having to click on a link to see them?

  59. Jallen |

    When I upgraded to the new version of the software, 4.0, I get a form_submission_error every time I try to tweet an article. The article does post to twitter but the form does not show “yes” as checked in the update twitter sidebar

    I deleted the plug in and reinstalled it but I still get the same error.

    Any idea how to fix this?

  60. Lauren |

    I’m getting a “Badly formed or empty plugin code” every time I try to install this plugin… using TXP 4.5.4.
    Can you please double-check it?

  61. James |

    I’m getting the same error as Jallen, with a clean install of the plugin (I have never had it installed before).

    The tweet does go out, but but throws a bunch of pop errors saying the form could not be submitted.

    I’m running PHP version: 5.3.27 and Textpattern version 4.5.4 (r4919)