Updating WP-OpenID to support ID Selector

by billso on Wednesday, 30 April 2008

Today I spent a few minutes modifying the WP-OpenID plugin to support JanRain’s ID Selector.

I added OpenID support to billso.com last month. This page has more information about the OpenID signle sign-on (SSO) system. Short story: OpenID lets users log in to a site with an ID they obtained on another web site. There are many different providers of OpenIDs, and many Internet users have not heard of the OpenID system.

So the ID Selector box provides opportunities to promote the OpenID system, and to add more users to a web site by supporting OpenID authentication.

Example of an OpenID selector box

The ID Selector is a small dropdown box that gives the user several choices for an OpenID provider. The system uses a small piece of JavaScript that calls a centralized server at www.idselector.com and generates an attractive selection box.

WP-OpenID doesn’t support ID Selectors yet, so I modified the code myself. The code is available in this ZIP file as interface.php

Installation is easy. Simply download my zipped file, extract the php file, edit it to include the ID Selection script that can be generated here, and upload the modified php file to your WordPress server at wp-content/plugins/openid/

The only hitch I have seen is that the selection button does not render properly in Safari, possibly because Safari uses its own weird buttons. In Firefox and Internet Explorer, it seems to work.

I’m tested this against WP 2.51 and WP-OpenID 2.1.8. I’m sure other people will find issues, so please add a comment to this post and check out my other OpenID posts, too.

For WordPress sysads who want to type in the modified code themselves, here’s an example. The code that must be changed is found in function login_form() as follows:

<label>Or login using your
<a class="<?php echo $link_class; ?>"
href="http://openid.net/">OpenID</a> url:<br/>

<input type="text" name="openid_url"
id="openid_url" class="input openid_url"
value="" size="20" tabindex="25" /></label>

</p>

<!-- this section remaps the OpenID Selector
box to the proper field on the form-->
<script type="text/javascript">
  <!--
      idselector_input_id = "openid_url";
    -->
</script>

<!-- insert the ID SELECTOR script that
you generated at idselector.com AFTER THIS LINE -->

<!-- BEGIN ID SELECTOR -->

<script type="text/javascript"
id="__openidselector"
src="https://www.idselector.com/selector/hex"
charset="utf-8"></script>

<!-- END ID SELECTOR -->
<!-- the rest of the interface.php
proceeds as originally written-->

<?php
}
  • Share/Bookmark

{ 2 trackbacks }

» Silicon Florist’s links arrangement for April 30 - Silicon Florist
Wednesday, 30 April 2008 at 21:02 HST @918
WP-OpenID and ID Selector
Thursday, 13 November 2008 at 20:12 HST @883

{ 5 comments }

billso Thursday, 1 May 2008 at 11:35 HST @524

My article was mentioned on this LiveJournal post earlier today.

Dan Fulbright Saturday, 10 May 2008 at 12:58 HST @582

Thank you so much! I added the ID Selector to my blog, and it shows up on the login page, but not the comment form. Is there an easy way to add it to the comment form?

Thanks again!

 — df

billso Saturday, 10 May 2008 at 15:06 HST @670

I’ve written some code to do just that, Dan. Just sent it to you, and I will post it in a new article tomorrow! Thanks for your question.

Kevin Fox Monday, 2 June 2008 at 08:13 HST @384

I know I am a little late to the party here but I work for Vidoop and we run an affiliates program at affiliates.vidoop.com which has the ID Selector integrated. Our OpenID provider http://myvidoop.com offers a online password manager plug-in, two factor authentication, etc.

billso Saturday, 18 October 2008 at 14:21 HST @640

I’ve updated this code for WP-OpenID v3. See the new code at http://billso.com/2008/10/18/openid-id-selector-and-wordpress/

Comments on this entry are closed.

blog comments powered by Disqus

Previous post:

Next post: