<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>2718.us blog &#187; plugin</title>
	<atom:link href="http://2718.us/blog/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://2718.us/blog</link>
	<description>Miscellaneous Technological Geekery</description>
	<lastBuildDate>Tue, 18 May 2010 02:42:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>OpenID Works!</title>
		<link>http://2718.us/blog/2009/10/19/openid-works/</link>
		<comments>http://2718.us/blog/2009/10/19/openid-works/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 00:53:12 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[badbehavior]]></category>
		<category><![CDATA[janrain]]></category>
		<category><![CDATA[myopenid]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rpx]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=189</guid>
		<description><![CDATA[Several weeks ago, I attempted to enable OpenID logins on this blog.  It didn&#8217;t work well.  It didn&#8217;t work at all.  Bad Behavior, which I consider absolutely critical in cutting down the impact of spambots, also broke the chain of redirects/reposts that enable OpenID logins.  Now, however, with Bad Behavior 2.0.30 (and 2.0.31), the RPX [...]]]></description>
			<content:encoded><![CDATA[<p>Several weeks ago, <a href="http://2718.us/blog/2009/08/30/2718-us-blog-now-with-openid/">I attempted to enable OpenID logins on this blog</a>.  It didn&#8217;t work well.  It didn&#8217;t work at all.  <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a>, which I consider absolutely critical in cutting down the impact of spambots, also broke the chain of redirects/reposts that enable OpenID logins.  Now, however, with <a href="http://www.bad-behavior.ioerror.us/2009/10/15/bad-behavior-2-0-30/">Bad Behavior 2.0.30</a> (and <a href="http://www.bad-behavior.ioerror.us/2009/10/17/bad-behavior-2-0-31/">2.0.31</a>), the <a href="http://wordpress.org/extend/plugins/rpx/">RPX plugin from JanRain</a> works!</p>
<p>It is now possible to log in with OpenID, automatically creating an account, and to associate an existing account with an OpenID for future logins.</p>
<p>Personally, I suggest <a href="https://www.myopenid.com/">MyOpenID</a> (from JanRain) because it gives the option of using PhoneFactor&#8217;s phone-call-based 2-factor authentication.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/10/19/openid-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Yo)URL Shortening and Twitter-Announcing of Posts</title>
		<link>http://2718.us/blog/2009/09/21/yourl-shortening-and-twitter-announcing-of-posts/</link>
		<comments>http://2718.us/blog/2009/09/21/yourl-shortening-and-twitter-announcing-of-posts/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 09:07:29 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[idn]]></category>
		<category><![CDATA[idns]]></category>
		<category><![CDATA[internationalized domain names]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[short url]]></category>
		<category><![CDATA[short urls]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[url shortening]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[yourls]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=180</guid>
		<description><![CDATA[A while back, I&#8217;d looked at a couple of plugins to automate the announcing of new blog posts on Twitter, but hadn&#8217;t really found one that I liked.  Today, I found myself playing with really short (one-character) IDNs, which led to thinking about URL shortening, which led to YOURLS, which led back to WordPress and [...]]]></description>
			<content:encoded><![CDATA[<p>A while back, I&#8217;d looked at a couple of plugins to automate the announcing of new blog posts on <a href="http://twitter.com/isaacgreenspan">Twitter</a>, but hadn&#8217;t really found one that I liked.  Today, I found myself playing with really short (one-character) <a href="http://en.wikipedia.org/wiki/Internationalized_domain_name">IDN</a>s, which led to thinking about URL shortening, which led to <a href="http://yourls.org/">YOURLS</a>, which led back to WordPress and using Twitter to announce new posts (<a href="http://wordpress.org/extend/plugins/yourls-wordpress-to-twitter/">YOURLS plugin</a>).</p>
<p>So, I&#8217;m posting this partly to spread the word and partly to see if the existence of this post will be successfully tweeted complete with short URL.</p>
<p>(NOTE: while YOURLS itself supported the IDN seamlessly, its WordPress plugin seemed to choke silently when pointed at the unicode form of the IDN for the YOURLS API and needed the punycode version to make it work.)</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/09/21/yourl-shortening-and-twitter-announcing-of-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2718.us Blog: Now with OpenID</title>
		<link>http://2718.us/blog/2009/08/30/2718-us-blog-now-with-openid/</link>
		<comments>http://2718.us/blog/2009/08/30/2718-us-blog-now-with-openid/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 02:37:14 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[badbehavior]]></category>
		<category><![CDATA[janrain]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rpx]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=167</guid>
		<description><![CDATA[I&#8217;m now trying the RPX plugin from JanRain to enable OpenID logins on this blog.  On the negative side, I&#8217;m committed to using BadBehavior to knock down server load from bots and BadBehavior seems to trap the redirect back here from your OpenID provider.  If you try to log in with OpenID and get an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m now trying <a href="http://wordpress.org/extend/plugins/rpx/">the RPX plugin from JanRain</a> to enable OpenID logins on this blog.  On the negative side, I&#8217;m committed to using <a href="http://www.bad-behavior.ioerror.us/">BadBehavior</a> to knock down server load from bots and BadBehavior seems to trap the redirect back here from your OpenID provider.  If you try to log in with OpenID and get an error screen instead of being redirected back to the blog, just go to your address field and hit enter to soft-reload the page and things should be fine.</p>
<p><em>Edit</em>: actually, OpenID login now seems to be entirely broken.  Hmm&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2009/08/30/2718-us-blog-now-with-openid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Authenticating with WordPress 2.6 (part 3)</title>
		<link>http://2718.us/blog/2008/08/03/authenticating-with-wordpress-26-part-3/</link>
		<comments>http://2718.us/blog/2008/08/03/authenticating-with-wordpress-26-part-3/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 23:55:48 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[2.6]]></category>
		<category><![CDATA[action hook]]></category>
		<category><![CDATA[add_action]]></category>
		<category><![CDATA[admin_cookie_path]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[auth_redirect]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[cookie path]]></category>
		<category><![CDATA[cookie paths]]></category>
		<category><![CDATA[COOKIEPATH]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[do_action]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[is_user_logged_in]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin api]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[set_auth_cookie]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[user authentication]]></category>
		<category><![CDATA[user login]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress 2.6]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp2.6]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=82</guid>
		<description><![CDATA[So, as a followup to parts 1 and 2, per WordPress Trac ticket #7001, WordPress 2.6 has split up the login cookies into three parts: what was the one and only login cookie in 2.5 is now limited to /wp-admin there&#8217;s a copy of that one that&#8217;s just limited to /wp-content/plugins, for backward compatibility with [...]]]></description>
			<content:encoded><![CDATA[<p>So, as a followup to parts <a href="http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-1/">1</a> and <a href="http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-2/">2</a>, per <a href="http://trac.wordpress.org/">WordPress Trac</a> <a href="http://trac.wordpress.org/ticket/7001">ticket #7001</a>, WordPress 2.6 has split up the login cookies into three parts:</p>
<ul>
<li>what was the one and only login cookie in 2.5 is now limited to /wp-admin</li>
<li>there&#8217;s a copy of that one that&#8217;s just limited to /wp-content/plugins, for backward compatibility with plugins</li>
<li>there&#8217;s a new cookie that is at COOKIEPATH (which can be defined in your config file), that is checked by calling
<pre>is_user_logged_in()</pre>
<p> (but perhaps this isn&#8217;t intended for secure authorization?)</li>
</ul>
<p>So, it appears the way to go may be to change
<pre>auth_redirect()</pre>
<p> to </p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>is_user_logged_in<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> auth_redirect<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>Maybe more to follow on this when I&#8217;ve more thoroughly explored it.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/08/03/authenticating-with-wordpress-26-part-3/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Authenticating with WordPress 2.6 (part 2)</title>
		<link>http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-2/</link>
		<comments>http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-2/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 04:32:54 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[2.6]]></category>
		<category><![CDATA[action hook]]></category>
		<category><![CDATA[add_action]]></category>
		<category><![CDATA[admin_cookie_path]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[auth_redirect]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[cookie path]]></category>
		<category><![CDATA[cookie paths]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[do_action]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin api]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[set_auth_cookie]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[user authentication]]></category>
		<category><![CDATA[user login]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress 2.6]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp2.6]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=70</guid>
		<description><![CDATA[Having stated the problem and now played further, I&#8217;ve got good news and bad news. The good news is that there&#8217;s an action hook, &#8216;set_auth_cookie&#8217;, that gets called whenever the cookies are set, so if the stuff for which you want to authenticate is on the same server but at a different path, you can [...]]]></description>
			<content:encoded><![CDATA[<p>Having <a href="http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-1/">stated the problem</a> and now played further, I&#8217;ve got good news and bad news.</p>
<p>The good news is that there&#8217;s an action hook, &#8216;set_auth_cookie&#8217;, that gets called whenever the cookies are set, so if the stuff for which you want to authenticate is on the same server but at a different path, you can create a plugin (or maybe use functions.php in your theme?) with something like the following:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> your_unique_name_here_set_auth_cookie<span class="br0">&#40;</span><span class="re1">$auth_cookie</span><span class="sy0">,</span> <span class="re1">$expire</span><span class="sy0">,</span> <span class="re1">$expiration</span><span class="sy0">,</span> <span class="re1">$user_id</span><span class="sy0">,</span> <span class="re1">$scheme</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">setcookie</span><span class="br0">&#40;</span>AUTH_COOKIE<span class="sy0">,</span> <span class="re1">$auth_cookie</span><span class="sy0">,</span> <span class="re1">$expire</span><span class="sy0">,</span> <span class="st0">&#39;/path/to/your/stuff&#39;</span><span class="sy0">,</span> COOKIE_DOMAIN<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">add_action<span class="br0">&#40;</span><span class="st0">&#39;set_auth_cookie&#39;</span><span class="sy0">,</span><span class="st0">&#39;your_unique_name_here_set_auth_cookie&#39;</span><span class="sy0">,</span><span class="nu0">10</span><span class="sy0">,</span><span class="nu0">5</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>The bad news is that if your WordPress install is at example.com/something and you want to use it to authenticate at portal.example.com, you can&#8217;t set a cookie for portal.example.com from a script on example.com, so your only choice would be to set a cookie with path / on .example.com (note the leading period), which completely breaks the security added by the separate cookies.</p>
<p>Hopefully, there&#8217;ll be a &#8220;part 3&#8243; to this wherein I solve this last problem somehow, since that&#8217;s the setup I&#8217;m dealing with.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/07/29/authenticating-with-wordpress-26-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hiding the WordPress Dashboard</title>
		<link>http://2718.us/blog/2008/07/10/hiding-the-wordpress-dashboard/</link>
		<comments>http://2718.us/blog/2008/07/10/hiding-the-wordpress-dashboard/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 20:34:55 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[deepwave]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[hide dashboard]]></category>
		<category><![CDATA[hide dashboard plugin]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=48</guid>
		<description><![CDATA[I use WordPress as the backbone of a site I run, including using it for user authentication.  This means a lot of people who aren&#8217;t invovled in running the site are logging in and could see the dashboard.  Now, it&#8217;s not that there&#8217;s anything really secret there, but it makes things look a lot less [...]]]></description>
			<content:encoded><![CDATA[<p>I use WordPress as the backbone of a site I run, including <a href="http://2718.us/blog/2008/04/12/using-wordpress-for-user-authentication/">using it for user authentication</a>.  This means a lot of people who aren&#8217;t invovled in running the site are logging in and could see the dashboard.  Now, it&#8217;s not that there&#8217;s anything really secret there, but it makes things look a lot less &#8220;finished&#8221; to have users deposited on a page that has no relevance to them.  This is where the <a href="http://www.deepwave.net/articles/hide_dashboard/">Hide Dashboard plugin</a> from <a href="http://www.deepwave.net/">Patrick/DeepWave</a> comes in.  It does a nice job of getting users to their profile page and generally hiding most of the dashboard things that regular users don&#8217;t need to see.</p>
<p>I, however, wanted a little more.  I wanted to make sure that regular users who might be, well, &#8220;curious&#8221; about the inner workings of the site and who have some knowledge of wp-admin URL structure to be unable to get at anything but their profile page.  To this end, I added a little to the code:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// add after line 41, which reads: &nbsp;if(!current_user_can(&#39;level_10&#39;)){</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">strpos</span><span class="br0">&#40;</span><span class="re1">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#39;REQUEST_URI&#39;</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="st0">&#39;/wp-admin&#39;</span><span class="br0">&#41;</span> <span class="sy0">!==</span> <span class="kw2">FALSE</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; and <span class="kw3">strpos</span><span class="br0">&#40;</span><span class="re1">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#39;REQUEST_URI&#39;</span><span class="br0">&#93;</span><span class="sy0">,</span><span class="st0">&#39;/wp-admin/profile.php&#39;</span><span class="br0">&#41;</span> <span class="sy0">!==</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; wp_safe_redirect<span class="br0">&#40;</span><span class="st0">&#39;/wp-admin/profile.php&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>This should redirect any non-admin user off of any /wp-admin* page to /wp-admin/profile.php. This might, however, cause issues for mid-level users (i.e. authors/editors/etc may not be able to access needed functions) and I haven’t tested it thoroughly and there might be a better way to do this. YMMV.  See also some comment-discussion on these changes at the plugin&#8217;s own page: <a href="http://www.deepwave.net/articles/hide_dashboard/#comment-22042">me</a> <a href="http://www.deepwave.net/articles/hide_dashboard/#comment-23750">Patrick</a> <a href="http://www.deepwave.net/articles/hide_dashboard/#comment-23751">me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/07/10/hiding-the-wordpress-dashboard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Oh, so *that&#8217;s* why the WordPress.com stats plugin said I had no traffic&#8230;</title>
		<link>http://2718.us/blog/2008/05/01/oh-so-thats-why-the-wordpresscom-stats-plugin-said-i-had-no-traffic/</link>
		<comments>http://2718.us/blog/2008/05/01/oh-so-thats-why-the-wordpresscom-stats-plugin-said-i-had-no-traffic/#comments</comments>
		<pubDate>Thu, 01 May 2008 20:38:24 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[footer.php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[stats plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress 2.5]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wordpress.com stats]]></category>
		<category><![CDATA[wordpress.com stats plugin]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp plugin]]></category>
		<category><![CDATA[wp stats]]></category>
		<category><![CDATA[wp2.5]]></category>
		<category><![CDATA[wp_footer]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=32</guid>
		<description><![CDATA[It seems that some themes that I&#8217;d used as the bases for my own themes on my WordPress installs (other than this one) didn&#8217;t have &#60;?php wp_footer(); ?&#62; in the footer.php file, like they should, I guess, since that seems to be what the WordPress.com stats plugin needs to register hits.  I had been wondering [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that some themes that I&#8217;d used as the bases for my own themes on my WordPress installs (other than this one) didn&#8217;t have</p>
<pre lang="php">&lt;?php wp_footer(); ?&gt;
</pre>
<p>in the footer.php file, like they should, I guess, since that seems to be what the WordPress.com stats plugin needs to register hits.  I had been wondering why the numbers on my dashboards didn&#8217;t even remotely match my awstats numbers.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/05/01/oh-so-thats-why-the-wordpresscom-stats-plugin-said-i-had-no-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using WordPress for User Authentication, Part 2</title>
		<link>http://2718.us/blog/2008/04/16/using-wordpress-for-user-authentication-part-2/</link>
		<comments>http://2718.us/blog/2008/04/16/using-wordpress-for-user-authentication-part-2/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 18:08:33 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[2.5]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[auth_redirect]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filter hook]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pluggable]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[user authentication]]></category>
		<category><![CDATA[user login]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress 2.5]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp plugin]]></category>
		<category><![CDATA[wp2.5]]></category>
		<category><![CDATA[wp_redirect]]></category>
		<category><![CDATA[wp_safe_redirect]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=22</guid>
		<description><![CDATA[After implementing other pages that used WordPress to authenticate users and deal with access control, I went to move these pages off to a subdomain, and suddenly found that auth_redirect wasn&#8217;t quite working right.  When auth_redirect is called and doesn&#8217;t find a logged-in user, it redirects to login and passes the URI of the current [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://2718.us/blog/2008/04/12/using-wordpress-for-user-authentication/">implementing other pages that used WordPress to authenticate users and deal with access control</a>, I went to move these pages off to a subdomain, and suddenly found that <a href="http://codex.wordpress.org/Function_Reference/auth_redirect">auth_redirect</a> wasn&#8217;t quite working right.  When auth_redirect is called and doesn&#8217;t find a logged-in user, it redirects to login and passes the URI of the current page&#8230; well sort of.  It passes the request string, but it ignores the server part.  So, when the login page is done and tries to redirect, it&#8217;s going back to the main WordPress server, not the subdomain.  Fortunately, auth_redirect is a very simple function to duplicate and it is designated as <a href="http://codex.wordpress.org/Pluggable_Functions">pluggable</a>&#8211;that is, a plugin can be used to redefine auth_redirect, so I&#8217;ve now got a plugin that overrides auth_redirect() with auth_redirect($use_current_host = FALSE) so that if I want auth_redirect to pay attention to the host, I call auth_redirect(TRUE).</p>
<p>This is all fine and good, but still doesn&#8217;t quite work, since WordPress is smart and won&#8217;t just redirect anywhere willy-nilly.  It will only redirect to authorized-for-redirecting servers (wp_safe_redirect, which doesn&#8217;t have any documentation in the Codex).  Though undocumented (or at least not well documented in the Codex), the way the authorized host list is handled allows for a plugin to add a <a href="http://codex.wordpress.org/Plugin_API#Filters">filter hook</a> that modifies the allowed list (since the allowed list by default only includes the actual WordPress server name and isn&#8217;t exposed as an option/setting anywhere).  Toss that hook into my plugin, add on a settings page to allow the admin to input a comma-separated list of allowed-for-redirecting hosts, and now I can use WordPress to authenticate users on subdomains.</p>
<p>If anyone is interested in this plugin, please let me know and I&#8217;ll try to clean it up engouh to make it public.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/04/16/using-wordpress-for-user-authentication-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

