The annoying thing with the WordPress OpenID Plugin

There’s a problem with the WordPress OpenID plugin, if you’re using a different home and site URL in your WordPress setup. This comes to show when you get a 404 error after you have authenticated with your OpenID provider, and it sends you back to your WordPress.

I usually install my WordPress files in /wp/ but prefer the home URL to be /. This way the WordPress-specific stuff is hidden away in it’s own directory. Something is broken in the OpenID plugin though, causing people authenticating with OpenID to end up at this URL:

http://website.com/wp/openid/consumer?janrain_nonce=2012..

Grepping through the files of the OpenID plugin, it looks like the problem can be fixed with a little tweak to the common.php file:

function openid_service_url($service, $scheme = null) {
	global $wp_rewrite;
	if (!$wp_rewrite) $wp_rewrite = new WP_Rewrite();

	if (!defined('OPENID_SSL') || !OPENID_SSL) $scheme = null;
	$url = site_url('/', $scheme); // Change site_url to home_url here!

	if ($wp_rewrite->using_permalinks()) {
		$url .= 'index.php/openid/' . $service;
	} else {
		$url .= '?openid=' . $service;
	}

	return $url;
}

That’s it, I think. Strangely enough, most OpenID projects have been dead for years. I wonder if its dying out.

UPDATE: I’ve since stopped using this plugin and switched to Social Connect.

Posted Monday, December 17th, 2012 under Uncategorized.

Leave a Reply

You must be logged in to post a comment.