A few hours ago, I was sitting at my office and thought that it would be nice if I could easily display my latest Twitter replies (or “tweets at me”) on my blog. Then I remembered that I had been wanting to create an actual WordPress plugin, so I began writing code and pulling a couple bits from my TwitterTech code.
After a short break for dinner, I’ve completed Tweets @ Me, a little plugin for WordPress that lets you display your replies.
So you want to skip all the reading and jump right in, eh? Before you do, you should be aware of a couple very important things. First, you need to know that if you don’t make sure your tm_tweets.txt and tm_last.txt files are world writable (chmod 777), it will not work properly. If you need help with that, ask your hosting provider. Also, the first time it is loaded it will send a tweet from you about itself. This will only happen once (unless your tm_last.txt file is not writable). If you want to turn this off, feel free to see the configuration options section below. If you appreciate my work and want to share it, leave this feature on or turn it off and send out a tweet manually.
To install (I like Edit+ for config files):
1. Open and edit tm_config.inc.php. You must provide your Twitter.com username and password .
2. Upload the “tweetsatme” folder to your WordPress plugins directory
3. Chmod 777 the two .txt files Very important!
4. Log in to your blog’s admin panel and activate the plugin from the Plugins page.
5. Add the following line in your template:
<?php display_tweets_at_me(); ?>
6. Visit your blog to see it in action.
Why do this?
It’s a similar principal to the “recent comments” plugins we’ve seen everywhere. You display the recent replies as incentive for people to leave you more replies.
How does it work?
It’s pretty simple, really. It logs in once per hour and grabs all Twitter replies sent to you. It then displays the last five to your blog. You can add (or remove) it easily and can customize the configuration and style to your liking.
Username [twitter username] : You need this to grab your replies.
Password [twitter password] : You need this to grab your replies.
To Display [5/any number] : This is the number of replies to display on your blog.
Announce [yes/no] : If set you “yes”, the plugin will send out the tweet the first time it’s loaded in your blog.
Debug [no/yes] : If set you “yes”, it will continue to grab new tweets and re-write the display HTML every time it is loaded. The most likely reason you would need to set this to “yes” is to see style changes as you make them. Just remember to set it back to “no” when you’re done so the plugin can cache your replies.
Seconds [3600/any number above 60] : This is the number of seconds to wait between getting replies again. It’s set to 3600 (one hour) by default because Twitter imposes a limit to how many API calls your username can make per hour. Keep this number above 60 if you want this plugin to work all the time. If you get any less than one reply per hour, be nice to twitter and leave it at 3600.
Width [130/any number] : This is the width of the plugin.
Margin [0px/any number] : If you don’t know, leave it alone.
Padding [3px/any number] : If you don’t know, leave it alone.
Border-Top [0px dashed #ff0000/css border] : If you don’t know, leave it alone.
Border-Right [0px dashed #ff0000/css border] : If you don’t know, leave it alone.
Border-Bottom [0px dashed #ff0000/css border] : If you don’t know, leave it alone.
Border-Left [0px dashed #ff0000/css border] : If you don’t know, leave it alone.
Divider [(blank)/some html] : This is any HTML you would like between replies displayed like a line or image.
Font-Size [10/any number] : This is the font size of the text.
Font-Color [#000000/any color] : This is the color of the text.
BG1 [#ffffff/any color] : This is the background color of replies.
BG2 [#c2c2c2/any color] : This is alternating the background color of replies.
Please feel free to post questions below or via email. I’ll answer as quickly as possible. I hate when I install software and can’t get support, so I’ll do my best to come through for you.
Also, any version updates, etc. will be posted here.
The only reason I was able to make such quick work of this plugin is the classes I had at my fingertips. So big fat thanks go out to the following people for the classes:
* @author Michal Migurski (JSON class)
* @author Matt Knapp (JSON class)
* @author Brett Stimmerman (JSON class)
* @author Nick Beam (Twitter class)