<?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; add_action</title>
	<atom:link href="http://2718.us/blog/tag/add_action/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>WordPress 2.6 + bbPress 0.9.0.2</title>
		<link>http://2718.us/blog/2008/08/16/wordpress-26-bbpress-0902/</link>
		<comments>http://2718.us/blog/2008/08/16/wordpress-26-bbpress-0902/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 23:48:33 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[0.9.0.2]]></category>
		<category><![CDATA[2.6]]></category>
		<category><![CDATA[action hook]]></category>
		<category><![CDATA[add_action]]></category>
		<category><![CDATA[bbpress]]></category>
		<category><![CDATA[bbpress 0.9.0.2]]></category>
		<category><![CDATA[clear_auth_cookie]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[set_auth_cookie]]></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=93</guid>
		<description><![CDATA[In case anyone was still curious following my previous headache post, it is possible to integrate WP2.6 and bbPress 0.9.0.2.  I say &#8220;possible&#8221; because while I&#8217;ve got it working as far as I can tell (without having modified core code in either WP or bbP), I haven&#8217;t really tested it and it&#8217;s a mess.  More [...]]]></description>
			<content:encoded><![CDATA[<p>In case anyone was still curious following <a href="http://2718.us/blog/2008/08/03/wordpress-26-is-giving-me-a-headache/">my previous headache post</a>, it <strong>is possible</strong> to integrate WP2.6 and bbPress 0.9.0.2.  I say &#8220;possible&#8221; because while I&#8217;ve got it working as far as I can tell (without having modified core code in either WP or bbP), I haven&#8217;t really tested it and it&#8217;s a mess.  More or less, a specially-crafted plugin for WP plus a specially-crafted plugin for bbP got me nearly there.  The one hangup was the login cookie (the new one that is at the root of the site), which while my bbPress plugin seemed to be duplicating it, WP didn&#8217;t want to recognize it (I couldn&#8217;t find any difference between the cookie set by my bbP plugin and the one set by WP, but WP didn&#8217;t like mine anyway).  I got around this by bypassing the bbP login mechanism entirely and using the WP login with a redirect back to bbPress.</p>
<p>Of course, it&#8217;s also annoying that while there&#8217;s a set_auth_cookie action hook, there&#8217;s no clear_auth_cookie, so my plugins had to override the clear_auth_cookie function wholesale rather than hooking into it as they do with set_auth_cookie.</p>
<p>If you have some twisted desire to make this unholy integration that I now seem to have working and would like some of my code, leave me a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/08/16/wordpress-26-bbpress-0902/feed/</wfw:commentRss>
		<slash:comments>3</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>
	</channel>
</rss>

