Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-29 23:25:51

jan
Member
From: Utrecht, The Netherlands
Registered: 2006-08-31
Posts: 71
Website

jrh_twounter: add twitter follower count to you site

Hi there, created (actually ported) my first plugin.
If you have suggestions or something is not working right, please let me know!

Download link: http://textpattern.org/files/jrh_twounter_v0.9.txt

=======================================================
Function of this plugin

This plugin provides one single tag which you can put anywhere in your page to display the number of followers of your Twitter profile.

Credits

This plugin was ported with permission from the Twounter Wordpress plugin (v1.01) by Muhammad Haris (link).

Kudos should be given solely to Muhammad, I myself have only modified it to be compatible with Textpattern.

Requirements

  • Textpattern 4.20 or newer.
  • A host that allows fopen wrappers, since use is made of the PHP function file_get_contents.
  • The plugin adds one table called ‘jrh_twounter’ to your database as soon as you enable the plugin. The table is dropped upon removal of the plugin.

How to use

Call the jrh_twounter tag, and for the ‘username’ attribute, specify your Twitter username.

Example that gives the number of followers of twitter.com/textpattern:

<txp:jrh_twounter username="textpattern" />

Formatting

The tag returns just an unformatted number, so add your own HTML markup around the tag to suit your needs.
=======================================================

Note for advanced users: the number of followers is cached in the database, and updated each 5 hours (18000 seconds). The original author chose this interval because of the limited amount of API calls that Twitter allows. You can tune this by altering the $api_time_seconds variable at line 110 of the source code.


Kensington TXP powered rock

Offline

Board footer

Powered by FluxBB