Posted on Thu 29 July 2010 in software.
I mentioned a while ago that I had problems getting OpenID support on this blog.
I’ve now resolved them (as you can probably tell from the title) and heres a quick howto.
You need to remove it, else Bad Things® will happen.
1: Install OpenID, XRDS-Simple and Comments with OpenID
This is the easy bit. Admin > Plugins > Add New and search for “openid” and “xrds”. Select, install, activate.
2: Set the Blog Owner
Set which user is the blog owner. Admin > Settings > OpenID. If you have 2 separate accounts, one admin and one editor (and if not, why not?) you will have to enable “Editor” in “Enable OpenID”, save the changes, then set the blog owner. Now you can use a simplified URL (eg http://samwwwblack.lapwing.org rather than http://samwwwblack.lapwing.org/author/samwwwblack)
3: Turn off OpenID for comments
I know this seems counter intuitive, but the OpenID plugin includes a technically cool but UIally (cough) crap way to do OpenID comments. The OpenID for Comments plugin (keep up) will handle this a lot better.
Goto Admin > Settings > Discussion and uncheck “Enable OpenID for comments”
4: Add OpenID to your template
Goto Admin > Appearance > Editor, then select “comments.php” (the default theme should already be selected; if not, select it from “Select theme to edit:” in the top right corner).
About 3/4s the way down, add the code in red between the URL block and the endif statement, as suggested below;
<label for="url"> <?php \_e('URL','precious'); ?> <small>(<?php _e('optional','precious');?>)</small> </label> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="30" tabindex="3" /> <label>Or enter your OpenId URL:</label> <?php comments_with_openid(); ?> <input type='text' name='openid_identifier' id='openid_identifier' class=textfield' tabindex='4' style='width:300px' /> <?php endif; ?> <label for="comment"> <?php _e('Your comment','precious');?> </label> <textarea name="comment" id="comment" cols="40" rows="10" tabindex="4"></textarea> <!--<small><strong>XHTML:</strong> <?php echo allowed\_tags(); ?></small>-->
This will add a selector for the OpenID provider which will populate the OpenID URL with the correct URI, and the appropriate text highlighted if you need to input a username (eg for LiveJournal the URL is http://USERNAME.livejournal.com; USERNAME will be highlighted for you to edit)
5: Add OpenID to the badbehaviour whitelist
This is one major thing that stopped me from using OpenID in the first place.
Goto Admin > Plugins > Editor and select the badbehaviour plugin. Select “bad-behavior/bad-behavior/whitelist.inc.php”, scroll down to “$bb2_whitelist_urls” and add the following in red;
// Includes two examples of whitelisting by URL. $bb2_whitelist_urls = array( // "/example.php", "/openid/server", "/index.php/openid/server", "/openid/consumer", "/index.php/openid/consumer", );
This will allow OpenID to work correctly.
6: Test your new OpenID system
What it says in the title.
When you use http://your.blog.com as the OpenID URL, it should direct you to your WordPress login, and/or to allow the site access to your OpenID.
You can check the trusted sites, and add other OpenIDs on your profile page under Profile > Your OpenIDs or Profile > Your Trusted Sites.
Nb; I’ve only briefly tried setting OpenID Delegation (in Profile > Your Profile) and it didn’t work properly. May have just been the URL I used. YMMV.