A few days ago my family signed up for Netflix. I had some spare time to play over the Thanksgiving weekend, so I installed and set up MyNetflix2 on my blog. Here’s how I did it. These instructions cover installation of MyNetflix2.0 beta on my web server (running FreeBSD 4.8). YMMV
- Download and uncompress the plug-in:
cd my_wordpress_dir/wp-content/plugins
fetch http://amphichon.com/wp-content/media/mynetflix20b.tar.gz
tar -xzf mynetflix20b.tar.gz
- The source file needs to be customized before it can be used. (I guess this isn’t technically a “plug-in” because of this.) First change needed is adding your personal Netflix RSS feed URL’s. To find these, login to your Netflix account and follow the link labeld “RSS” at the bottom of the Netflix page. Below the “Personalized Feeds” heading, you’ll find the RSS URL’s. Copy and paste them into MyNetflix source code.
- You may also need to modify other settings, particularly if you don’t have the “3-at-a-time” plan.
- Activate the plugin from the admin / Plugins page.
- Add some code to your WordPress theme (typically on a sidebar) to display however much of your queue, current DVD’s, and/or recent rentals that your wish. I’m using the code below to display the DVD’s we’re currently watching:
<?php if (function_exists('mynetflix')) { ?>
<h4><?php _e('Recent NetFlix Activity'); ?></h4>
<?php mynetflix('out'); ?>
<?php } ?>
- I’ll probably add some code to display recently returned DVD’s in the future. (We haven’t returned any discs yet, so this breaks the MyNetflix code right now.)
That’s all there is to it. I’m going to see if I can hack up an Options page for this code to make it a true plugin. This would handle the RSS ID string(s) and the $plan settings, and possibly the image layout options. If/when I finish that, I’ll send the changes to herichon for inclusion in the next release.
Well, we finally got around to joining Netflix yesterday, and we’ve already got 60 movies in our queue! Initially we signed up for the 3-at-a-time plan, but we’ll probably change to the cheapest plan once the novelty wears off.
Several of our friends already use Netflix, and they all had good things to say about the service. The only words of caution I received had to do with “throttling” of the movie pipe. This is spelled out in the terms of service, and basically says that if you burn through your queue they reserve the right to take their time sending your next movie. Fair enough, I guess.
Of course, this gives me another feature to hack/play with here on the blog: displaying our Netflix queue and/or recent activity. I was initially thinking of using Jimbo’s mynetflix 1.5 plugin, but he’s been pretty busy lately. It looks like development work has been taken over by Herichon, who recently released mynetflix2. I’ll be fiddling with this plugin and squeezing it into my page somewhere. Of course, this is going to be another customization that needs to be maintained for each theme, sigh.
If you’re a Netflix user reading this blog, feel free to add us (my wife and I) to your friends list. Our Netflix address is
netflix@thisblogsname.net
(In case that’s not clear enough, you’ll need to replace thisblogsname with SonicChicken.) My wife and I also have personal profiles to cover movies that we disagree about, for example I like Dr. Strangelove and she doesn’t. If you want to add us individually use our name instead of “netflix” in the account, e.g. jim@thisblogsname.net.
A few days ago, Joseph and I were talking about bolting statcounter onto our blogs. He’s the one that pointed out statcounter to me, and all he needed to do was add the statcounter script to his theme’s footer.php file. This would probably work for any single-theme site, but I’m still running multiple themes on my blog. I need to do one of the following if I want to use statcounter:
- Drop all but one theme. There are several good reasons for this, most important of which is maintenance. This would allow me to add the statcounter script to the remaining theme’s footer.php and I’d be done.
- Add statcounter to all my themes. This probably wouldn’t be too bad, except for maintenance–whenever a new version of one of my themes came out, I’d have to manually reapply my changes.
- Write a plugin to insert the statcounter script in the footer of every page. This would be the most work up front, but it would give me a good excuse to learn how to write plugins for WordPress.
I found some useful resources for plugin authoring. The WordPress codex has a section on writing plugins. Owen’s tutorial is a great introduction–just read it and start hacking!
Carthik’s Plunge into Plugins article has lots of good advice, but isn’t a tutorial–check it out after/while you get started with Owen’s page. More good info is available on the Codex page Writing a Plugin.
I’ve started working on this plugin, and I’ve already been bitten by the “extra blank line” problem. (Admin interface was reporting “Cannot modify header information - headers already sent by…” error. Note to self–scroll to the bottom of each PHP file, and make sure the PHP close tag is right at the bottom of the file.) I have the code to insert arbitrary text into the footer, but I still need to add the Options menu which would allow J. Random User to edit the text to be inserted. (Right now, the text is hard-coded in the “plugin”, which I have installed and activated on this blog. Check the bottom left corner of any blog page for the statcounter.)
I don’t see any reason for this plugin to be statcounter-specific. It would be more useful to provide some sort of generic footer plugin which would allow HTML or javascript to be inserted in the footer. We’ll see how it goes. If I’m happy with it by the end of the night or later this week, I will go ahead and release it.
I had a few folks post comments on some of my older posts, and I didn’t notice them right away. The problem is that I rarely use the WordPress “dashboard”, which is the easiest place to find recently added comments.
For several weeks, I’ve been meaning to bolt the Recent Comments plugin by Krischan Jodies’ onto the Journalized-Blue theme that I use. So I’d like to thank jim wilde, Bitcloud, and RTO Trainer first and foremost for commenting on my blog. Additional thanks are due for giving me the best incentive to get off my butt and get the necessary hacking done! While I was at it, I made some minor cosmetic changes to the interface, the most visible being the longer “top tags” list.
I’m thinking about using the free statcounter service on my site, but it requires that I add a little bit of javascript to each page. If I was running a single theme, I could probably find all the appropriate </body> tags and just paste in the statcounter code. But I’m trying to support multiple themes; besides, where’s the fun in cutting and pasting a bunch of code? Also, what if I need to change the statcounter code for some reason? So I think the Right Thing to do here is come up with a plugin for the wp_footer action which will insert some user-specified code, (in this case, my statcounter javascript). I haven’t found a plugin for statcounter, so I’ll be searching for a generic footer plugin. If I can’t find anything, I guess I’ll have to roll my own.