Archive for December, 2007

Connecting WordPress MU to Twitter to auto-tweet new blog posts

Monday, December 31st, 2007

twitter.pngGiven that over the past year Twitter has emerged as one of the new communication tools within social media, one of my natural reactions was to figure out how to connect this blog site to Twitter so that a post/tweet would appear in twitter.com/voxeo whenever we posted a new article. (If you are not aware of Twitter, my external “The 10 ways I learned to use Twitter in 2007” should give you an overview.) My main reason for wanting to do this was to provide another way for people to stay up on what we post here. For some people, myself included, it’s easier to follow someone on Twitter than even to subscribe to their RSS feeds. So I wanted to make it easy for someone to “follow” the posts we create here on blogs.voxeo.com.

My first instinct was to simply go over to Twitterfeed.com and set up a link between our RSS feed for all posts and our new Twitter account. This undoubtedly would have been the simplest path to go – and one I’d probably recommend for others. There were however, several problems/challenges/concerns:

  1. Twitterfeed.com requires the use of OpenID to login, which, as an OpenID advocate, I delight in. However, I wanted to create the feed using a Voxeo-related OpenID versus one of my own, so first I needed to go and turn this blog site into an OpenID provider.

  2. My second concern was just that Twitterfeed.com seemed somewhat inefficient in that it has to poll to find out if you had new posts to tweet. There’s naturally the potential time delay from posting… and also just the general inefficiency. We are not posting here all that often and don’t need the feeds checked all that much.

  3. My third concern was the issue of introducing yet another site in between this site and Twitter. Given Twitter’s API, it seemed logical that we could connect directly.

  4. By the time I got the site set up to provide OpenID, Twitter was experiencing some performance problems last Friday and the Twitterfeed.com site was also offline.

This last issue caused me to decide I had to solve the problem on our own server so that we aren’t dependent on another site.

A Google search brought me to the “Twitter Updater” plugin for WordPress which, on first glance, seemed to provide exactly what I was seeking. I followed the instructions, activated it for one of the blogs, filled in the credentials, posted a test post and……. nothing. No Twitter post. In further reading down the page, it became clear that the developer stopped further work on this plugin and in fact moved her blog from WordPress over to Drupal and so had no real interest in the plugin anymore. I tried a hack by another user, but it, too did not work.

Meanwhile a friend had recommended that I use Alex King’s great “Twitter Tools” plugin. I actually had it installed, but hadn’t really thought about it for purely posting to Twitter. The strength of the Twitter Tools plugin is really about taking your updates from Twitter and posting it to your blog (which the README clearly shows). However, in our case, we’re not going to be (or don’t expect to be, anyway) posting independently to twitter.com/voxeo. It’s just another publishing medium for us – a one-way publish out to the world of Twitter. So we don’t need to publish our tweets here because there won’t be any.

This is, however, the solution I ultimately used. I activated the plugin for one of the blogs on this site, configured it with our Twitter username and password and then changed the settings so that it was only publishing outbound to Twitter.

There was one change I did make to the PHP code. By default, every new blog post appears in your Twitter stream with the prefix “New blog post: “. However, since our Twitter stream is only new blog posts, this prefix is redundant and wastes some of our precious 140 characters! So I modified line 75 and 76 of “twitter-tools.php” from this:

$this->tweet_prefix = 'New blog post';
$this->tweet_format = $this->tweet_prefix.': %s %s';

to this:

$this->tweet_prefix = '';
$this->tweet_format = $this->tweet_prefix.'%s %s';

You can see the result now over on twitter.com/voxeo.

A couple of notes about this implementation:

  1. The good news is that this posts to Twitter as soon as we publish an article to a blog. No polling. No waiting. No reliance on a site in the middle (Twitterfeed). Just direct from our site to Twitter via the Twitter API.

  2. The good or bad news, depending upon your perspective, is that the plugin needs to be activated separately for each of your WPMU blogs. If you have a lot of WPMU blogs and all you want to do is take all the blog posts and post them to Twitter, you are probably far better off taking the Twitterfeed.com route and simply linking a site-wide RSS feed to a Twitter account. In our case, we don’t have a large number of blogs and while we anticipate adding a few more, we don’t expect to add a huge number. Activating/configuring this plugin is now something I’ll just add to my “provisioning checklist” when rolling out a new blog.

    Note that on the good news side, we do now have a much higher degree of control over precisely which blogs post to the Twitter.com/voxeo account. Because we have to manually configure it, we wind up having the flexibility to not configure certain blogs, so that their postings do not appear in the Twitter.com/voxeo stream. We also have the flexibility to configure a certain blog to post to a different Twitter account. That’s not something I see us doing, but we do now have the option, which we wouldn’t if we simply connected our “all blogs” RSS feed to a Twitter account.

  3. Do note that since we are using WordPress MU, after dropping the Twitter Tools plugin code into the “plugins” directory, I did need to go into the Site Admin page for the site and “allow” the use of the plugin for blogs on the site. After that, I could go into each individual blog, activate the plugin and then configure the settings.

  4. I have the plugin activated currently in four blogs and all are configured to post to the same Twitter account. Everything seems to be working fine.

So there it is… how I linked our WordPress MU blogs to Twitter to publish notifications to the Twitter account when we post new blog entries. Hopefully some of you out there will find this helpful.

Technorati Tags: , , , , , , ,


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


Supporting OpenID, part 1: Enabling the WPMU site to be used as an OpenID provider

Friday, December 28th, 2007

561B4AF1-C5A5-4363-B67E-E01ADD90084E.jpgI am a big fan of OpenID for a range of reasons, some of which I articulated here, Why bloggers should learn about OpenID, and others I have outlined in my other blogging about identity issues and discussed in a Security Round Table podcast about OpenID (the show notes for this podcast, by the way, provide a very large compilation of links to learn all about OpenID). So an objective I have is to make this blog support OpenID.

There are really two different aspects to “supporting” OpenID. First, a blog, or any other website, can be an OpenID provider in that it can be the source URL used as an “OpenID URL” to login to a site that supports OpenID. Second, a blog can support logins using OpenID.

The first part is the easiest and I’ve done this now using the “OpenID Provider for WordPress MU” plugin. Extremely simple to use. Just download, unzip, and drop the one PHP script and a subdirectory into your “mu-plugins” directory. Ta da. It is activated by default and now you can login to other sites with the URL of your blog (and, naturally, having logged into your own blog with a valid username and password).

How does this work in practice? Well, over on my LiveJournal blog I replied to a comment using OpenID to login. Here’s how the result looked:

ljopenidcomment.jpg

You can see the OpenID logo next to my name and then the URL for the main blog site. I chose to login with the OpenID of “http://blogs.voxeo.com/” but could have equally logged in with any of the actual blogs. (As far as WPMU is concerned, the portal page is one of the blogs… we’re just not using it in that way, i.e. there will never be posts to the “blog” that is our portal page.) What I am not showing in a screenshot is the intermediary step where I was presented with a page on my WPMU site where I had to authorize www.livejournal.com to obtain my identity information. I’m just showing the end result.

There are a couple of advantages to this. First, I can now have a work identity that is associated with my employer. Second, from a marketing point-of-view, I’m leaving the URL of my blog there in the comments for the post. Other readers can then click on the link to come back and visit this site. Third, as a user, I didn’t have to re-enter all this information to leave a comment. I just entered my OpenID URL, authorized the requesting site to use my identity and… ta da… there it was.

So that’s the “easy” part of turning your site into an OpenID provider. How about having this site support OpenID for comment logins? Welllll… that’s turning out to be a bit more challenging. In researching the matter, it looks like most folks are using the plugin “WP-OpenID“. I’ve downloaded and installed it, but because we do not have PHP 5 installed, I am experiencing the problems outlined in this support forum post: “Fatal Error / Parse error in Yaris.php when WP-OpenID activated“. I’ve modified the script as noted in the comments but am getting the “implode” error identified at the end by “ericabiz”. Once I either: upgrade to PHP5; wait for the authors to come out with a new rev; or find another solution; I will then write “Part 2″ about OpenID.

Technorati Tags: , , , , ,


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


A key factor to a successful WPMU install? Make sure you have “php-mysql”!

Friday, December 28th, 2007

wpmulogo.jpg

When I started the WordPress MU installation, I was very careful to step through the installation process outlined in the README file. I made sure MySQL was working. I made sure PHP was working. I stepped through the installation web page that you get. It seemed like I was doing everything exactly as I was supposed to do.

However, I was getting a completely blank page! Nothing at all. A 0-sized HTML page. And no PHP error logs. Nothing. I was completely and utterly confused and after spending the better part of a day trying to figure this all out was about ready to give up completely on WordPress MU. I posted to forums. I went on the #wmpu IRC channel. I bothered friends…. I believe it was ultimately someone in one of the Skype public groupchats I monitor that helped me out… I communicated with a ton of people that day!

In the end, it turned out to be one little command that was all that was needed:

# yum install php-mysql

You see, I was using a stock Fedora Linux installation and it had both PHP and MySQL installed, but did not have the package that glues them together installed. Oops.

One ‘yum’ command later and everything was working fine. The installation went ahead just as the README file said it should. All was good.

The good news out of all of this was that I learned an incredible amount about PHP and MySQL, both of which I had not really used in any serious way for a few years. I also became very good at doing a WPMU installation! (since I kept blowing away my installation to try it again!)


UPDATE 25 January 2008: In the comments to this post, Garth Roxburgh-Kidd has indicated that the command to do this update on Red Hat Enterprise Linux 4 (RHEL) is this:

# up2date php-mysql

Thanks, Garth!


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


Welcome to a glimpse behind a WordPress MU-powered site!

Thursday, December 6th, 2007

When I began work for Voxeo in late October, one of my first projects was to build the blog portal you are now reading. Unfortunately, there wasn’t a great amount of information out on the web about how to build a corporate blog portal on a technical level. I’d been writing and podcasting about this (also here) back in early 2007 and still hadn’t seen much in the way of great information. There are certainly services out there and a number of companies that will build these kind of portals for you. But, admittedly, some of us are “control freaks” and want to be able to control all aspects of the blog site – and are willing to put in the time to do so.

In early November 2007, I created a “Corporate Blog Portal” section of The New PR Wiki to try to summarize some of the information I had to date and to collect pointers to various software packages out there to develop these kind of portals. It seemed to me that for an open source solution, it really came down to three choices:

I should point out that our interest in evaluating open source software first was not as much about cost as it was about, again, control. We wanted the ability to tweak and modify the system so that it works with our other systems. For instance, traffic to the blog is now integrated into our centralized traffic tracking system for all our websites – a hack that we did because we could see all the source code and modify it. Had we been unable to find an open source solution that worked for us, we would certainly have proceeded on to evaluate the commercial options out there.

As I described in my external blog post, I ultimately chose WordPress MU to build this site, primarily because it provided the ability to use “tags” to generate “tag clouds” and was closest to the current WordPress release.

Having said that, if you’ve heard the (very) old joke about “what if operating systems were airlines?“, choosing to use “open source” is very often like getting a box of parts and having to figure out what to do with them all. Our experience with WordPress MU definitely had shades of that. It would seem that WPMU is really best designed for someone looking to create a site like Wordpress.com with hosted blogs. If you want to create a site like that, the installation is fairly straightforward and you’ll be up and running quickly.

However, if you want a “corporate blog portal”, such as what we have on blogs.voxeo.com, well… you’ve got a box of parts. Figure it out.

So we did… where “we” is myself and my colleague Rick. Rick is the one behind our other websites of www.voxeo.com and evolution.voxeo.com and is also the creator of this stunning (in my opinion!) Wordpress theme we are using. He’s the CSS guru and the one who did a lot of MySQL hackery. I’m the one working with plugins, writing content and otherwise administering the site.

This blog, then, is our attempt to give back a bit to the WPMU community and to share some of the lessons we’ve learned – and will continue to learn – as we use WordPress MU for a corporate blog portal. We’re going to be documenting some of the errors we made – and how we fixed them. We’ll talk about some of the modifications we had to make. Rick had to do some fine PHP/MySQL hacking to get our main blogs.voxeo.com page to show the last 5 entries across all of our (public) blogs – we’ll talk about that. We’ll talk about plugins we add and what we did or didn’t do to make them work. We’ll also use this blog as a way to document some of what we do and how improve the site.

It’s our hope that through doing this there may be others out there who will build their blog portals with WordPress MU and through collective information sharing we can all wind up building better sites. Feel free to ask questions… we’ll answer if we can. Join us in our journey…


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.