Skip to content

WordPress Plugin Update Checker

Dear Reader,

A quick one here for those writing WordPress plugins. I’m experimenting with something here and thought I’d share. One thing that bugs me about writing plugins is when I make a new version, I have to go to several places and announce that there’s an update available. So I’m toying with the idea of having the plugin check every x days to see of there has been an update.

The way I do this is in the plugin’s option page (the only place I would ever do this) I put the following code at the bottom of this post.

Currently, this one is hard coded to check every 7 days. I’m thinking about changing that to like 3 and maybe making it an option so the user can set it to 0 and never have it execute.

I’m throwing it out here for others to review. My question is, it is ok to have a plug in ‘phone home’? I know I’m not collecting any stats but this could easily get out of hand if some reasonable guidelines aren’t set.

Until next time,



* Version Check code.
* This is a bit verbose. I'd like to cut it down a bit. I know this works
* in almost all cases. Some places may not have curl installed. I could do
* it in AJAX calling the plugin itself with a parameter and firing off a
* call but that's basically the same as what I'm doing here. So why bother.
if (($notable_settings['last_version_check']+(86400*7))<mktime()) {
$elements = parse_url('
$current_version = 0.00;
$line = '';

if ($fp = @fsockopen($elements['host'],80)) {
fputs($fp, sprintf("GET %s HTTP/1.0\r\n" . "Host: %s\r\n\r\n", $elements['path'] .
(isset ($elements['query']) ? '?'. $elements['query'] : ''), $elements['host']));
while (!feof($fp)) $line .= fgets($fp, 4096);

$line = urldecode(trim(strtr($line,"\n\r\t\0"," ")));
$work_array = explode(" ",$line);
* This does not allow for any additional messages to be passed. It
* assumes that the last time coming in is the version #.
$current_version = $work_array[count($work_array)-1];
} // if ($fp)
if ($version!=$current_version) {
<div class="wrap" style="border:solid 1px red;">This is version <?=$version;?>. The current version
of the plugin is <?=$current_version;?>. Click <a href=""
target="_NEW" title="Opens a new window.">here</a> to go to the project page to find out more.
} else {
<div class="wrap">This is plugin is up to date.<br />
} // if ($version!=$current_version)
} else {
<div class="wrap" >
} // if ($notable_settings['last_version_check']!=(mktime()+(86400*7)))


Dear Reader,

Why, in God’s name, do you read this blog? For that matter, why does anyone read any blog?

I was reading /. this morning and came across this story (side note, I read the article discussed on /. last week, when it was published, not 3 days later when the /. community noticed it.) I love /. because of the readership’s ability to take any topic and turn the discussion to something else. Since I had read the article earlier and I was ‘un-involved’ at work at the moment, I decided to read the discussion. At 3+ I only had 12 comments to read through and yet still, I had very few comments that were relevant to the discussion of blog software. However, some of the comments did pique my interest.

One of the wandering lanes that the self-important posters of the /. community drove down was the topic of why people blog. To me, that’s obvious. The number one reason people blog is because other people will read it. It was interesting to watch them bicker over their different theories but if you look at it, there are only 2 reasons people blog. The other is because they have something to say.

After reading this discussion most of the day (there are now 32 comments at 3+) another question struck me. One that, if you are reading this blog (both of you by this point) you can answer. The real question is not “Why do people blog?”; the real question is “Why do people read blogs?”.

Why is it that we are so compelled to know what someone else is thinking that we will go out of our way to find out? If you are reading this particular blog, chances are the only reason you are here is because you know me. If you don’t know me and are reading this, I’d really like to know why. (I can rule out my deep thoughts so I’m curious, why?)

I know why I read the blogs I read. Some I read are for technical insight. I’ve been reading one blog since 1997. The site has changed but the knowledge hasn’t. It used to be sponsored by Compaq and called “The Rapidly Changing Face of Technology”. Now that Compaq tossed Jeffry to the curb, he has his own consulting practice and still publishes the best forward thinking blog I’ve ever ready under the name of The Harrow Group While Jeffrey doesn’t publish as often, every time he publishes, I take the time to read (or usually listen to) the entire thing. It never fails to inspire me at some level.

Other blogs I read for amusement. Some I read for their Soap Opera like quality. Those who watch Soap Operas but hate to admit it understand what I am talking about. Sometimes, you just can’t help yourself, the tales are just too tragic.

What I don’t read blogs for is opinion. Even those opinions I respect I don’t bother to read. Why? I’m not sure. Maybe it’s because I’ve always railed at people telling me how to think. That’s why I hate traditional media and like news organizations that at least attempt to balance their reporting by showing both sides. Blogs are nothing more than someone else’s opinion about something and since I usually have my own opinion, why do I need another one?

Anyhow, that’s my question for now Dear Reader, I’m on a quest. Why do you read blogs? Any type of blog? Ironically, if you are reading this, I know the answer…and if you aren’t, I’ll never know.

Until next time, it’s good to have a plan now.