Content last modified Friday 3 July 2009
hop to #bottom
Categories:
Author:
Current version:
1.3
About It:
Get it:
Rate it:
  • Helpful?
  • 3 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

txp_twitter

txp_twitter is a plugin which writes a tweet at your space at twitter, each time you write or edit a post.

The instructions to install this plugin are easy. First of all, you have to download the plugin and install it into your textpattern installation. Then you must edit the plugin to change the username and password in order to use your data from twitter and then, you must just activate it.

The plugin uses a library called curl that sometimes isn’t installed at the servers. But in my case, it was installed and it works fine.

Updated: The new release uses an extra field (custom_1) in order to know when a tweet has already been sent. You can change the extra field just editting the plugin for another extra field (from 1 to 10), but if you change it, you must provide a name to the extra field in the preferences of your textpattern installation (Admin > Preferences > Advanced preferences).

[Ruud: download link seems to be dead at the moment, plugin code pasted below]

# txp_twitter v1.3
# This plugin sends a tweet at our twitter space.
# Fran Garcia
# http://www.frangarcia.net

# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................

YTo5OntzOjQ6Im5hbWUiO3M6MTE6InR4cF90d2l0dGVyIjtzOjc6InZlcnNpb24iO3M6Mzoi
MS4zIjtzOjY6ImF1dGhvciI7czoxMToiRnJhbiBHYXJjaWEiO3M6MTA6ImF1dGhvcl91cmki
O3M6MjU6Imh0dHA6Ly93d3cuZnJhbmdhcmNpYS5uZXQiO3M6MTE6ImRlc2NyaXB0aW9uIjtz
OjQ3OiJUaGlzIHBsdWdpbiBzZW5kcyBhIHR3ZWV0IGF0IG91ciB0d2l0dGVyIHNwYWNlLiI7
czo0OiJ0eXBlIjtpOjE7czo0OiJoZWxwIjtzOjczMDoiCjxzdHJvbmc+VFhQIFR3aXR0ZXI8
L3N0cm9uZz48YnI+PGJyPgoKVGhpcyBwbHVnaW4gc2VuZHMgYSB0d2VldCBhdCBvdXIgdHdp
dHRlciBzcGFjZS48YnI+PGJyPgoKWW91IG11c3QganVzdCBpbnN0YWxsIHRoZSBwbHVnaW4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CiAgICBjdXJsX3NldG9wdCgkY2gsIENVUkxPUFRfVkVSQk9TRSwgMSk7CiAgICBjdXJs
X3NldG9wdCgkY2gsIENVUkxPUFRfUkVUVVJOVFJBTlNGRVIsIDEpOwogICAgY3VybF9zZXRv
cHQoJGNoLCBDVVJMT1BUX1VTRVJQV0QsICIkdXNlcm5hbWU6JHBhc3N3b3JkIik7CiAgICBj
dXJsX3NldG9wdCgkY2gsIENVUkxPUFRfSFRUUF9WRVJTSU9OLCBDVVJMX0hUVFBfVkVSU0lP
Tl8xXzEpOwogICAgY3VybF9zZXRvcHQoJGNoLCBDVVJMT1BUX1BPU1QsIDEpOwoKICAgICRy
ZXN1bHQgPSBjdXJsX2V4ZWMgKCRjaCk7IC8vT2pvLCBoYXkgdW4gZXNwYWNpbyBlbiBleGVj
CiAgICAkcmVzdWx0QXJyYXkgPSBjdXJsX2dldGluZm8oJGNoKTsKICAgIGN1cmxfY2xvc2Uo
JGNoKTsKfQoKCiI7czozOiJtZDUiO3M6MzI6IjdhMDY4MzdiY2U5OTA4ZTc3ZjU5NTdjN2Mz
YzJkZTNjIjt9
Article Request Count:
Keywords/tags:
Initially released:
03.07.2007
Posted here:
03 Jul 2007
Article modified:
19 Aug 2008

If there is a comment form at the Information URL, you may want to leave your comments/questions there for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (11)

Sven:

Nice plugin, works great here. How would I include the posts title in the Twitter message? It would be nice to have the articles title wrapped in a permalink instead of “Look at this”

Hi Sven,

I have already uploaded a new version, which includes the title of the post instead of the text “Look at this”. Just download it and install it.

I hope you enjoy it!

Sven:

Great, thank you!

Would be great if the Twitter-MSG would only be send when creating a new Article, not every edit/update. How could i do that?

Yes Christian,

that would be great, but I don’t know how could I do this.

Maybe you can play with the data posted and the last mod in the select, but I’m not sure. Let me investigate about this, but if you find a solution, let me know it.

I’ve upload a new version of this plugin. The new version sends a tweet to our space at twitter.com, only when the article is a published a article and not in the other cases.

There is a new release of this plugin. In older release, everytime you made a modification to an article, a tweet was sent to your twitter account, but now, just one tweet is sent the first time you publish the article.

Joe:

Hi, Great plugin Fran.

How can I get it to post to Twitter when I post to Textpattern from XML-RPC?

Thanks!

ANIBAL:

hey fran buenisimo el plug! muchas gracias…
como hago para que se postee un Excerpt en twtter de mi post en el blog? saludos!!

Hola Anibal,

para hacer lo que quieres, debes editar el plugin desde la interfaz de textpattern y hacer lo siguiente:

1º) Cambiar $rs = safe_row(“ID, Title”, “textpattern”, “status=4 AND custom_1<>‘yes’ AND TIMEDIFF,LastMod)<‘00:00:30’ ORDER BY LastMod ASC”); por $rs = safe_row(“ID, Title,Excerpt”, “textpattern”, “status=4 AND custom_1<>‘yes’ AND TIMEDIFF,LastMod)<‘00:00:30’ ORDER BY LastMod ASC”);

2º) Cambiar postToTwitter(“frangarcia”,“llOE1978”,$rs[‘Title’].”: “.permlinkurl_id($rs[‘ID’])); por postToTwitter(“frangarcia”,“llOE1978”,$rs[‘Excerpt’].”: “.permlinkurl_id($rs[‘ID’]));

Eso es todo.

Dop:

Error

Warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(now(),LastMod)<‘00:00:30’ ORDER BY LastMod ASC’ at line 1 select ID, Title from sitetextpattern as textpattern where status=4 AND custom_1<>‘yes’ AND TIMEDIFF,LastMod)<‘00:00:30’ ORDER BY LastMod ASC in /home/l/xxx/public_html/site/textpattern/lib/txplib_db.php on line 82

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site. Get a Gravatar.

Would you care to write a comment?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
TxP · TxD · GG