<?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>The House of Ding &#187; Drupal</title>
	<atom:link href="http://www.houseofding.com/category/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.houseofding.com</link>
	<description>Technology, programming, design, and everything in-between.</description>
	<lastBuildDate>Fri, 30 Oct 2009 03:09:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Controlling execution order of Drupal modules</title>
		<link>http://www.houseofding.com/2009/06/controlling-execution-order-of-drupal-modules/</link>
		<comments>http://www.houseofding.com/2009/06/controlling-execution-order-of-drupal-modules/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 01:07:51 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[drupal php]]></category>

		<guid isPermaLink="false">http://www.houseofding.com/?p=207</guid>
		<description><![CDATA[So lately, this had become a &#8216;stuff that breaks at work&#8217; blog, but I fear that if I don&#8217;t document these, they&#8217;ll likely bite me again. And, if the solutions help someone else, then that&#8217;s&#160;great. Our team recently launched a large website in Drupal that uses many home-grown modules. I discovered that with certain modules, [...]]]></description>
			<content:encoded><![CDATA[<p>So lately, this had become a &#8216;stuff that breaks at work&#8217; blog, but I fear that if I don&#8217;t document these, they&#8217;ll likely bite me again. And, if the solutions help someone else, then that&#8217;s&nbsp;great.</p>
<p>Our team recently launched a large website in Drupal that uses many home-grown modules. I discovered that with certain modules, the execution order is very important; especially authentication modules. We&#8217;d developed a module that interacts with the University&#8217;s single sign-on service and automatically creates or loads a Drupal&nbsp;user.</p>
<h3>Order&nbsp;matters</h3>
<p>Everything worked perfectly in testing except 403 handling. Specifically, when an unauthenticated user encounters a page that requires authentication or a certain role (via the privacy by role module), the user would expect to be routed to the single sign-on form, authenticate, and then be returned to the resource they originally requested. This wasn&#8217;t happening. The user would click a protected link, login, and then encounter the default 403 page: &#8216;Access Denied.&#8217; The giveaway was that if you refreshed the page, the protected page would appear. After hours of debugging, I discovered that it was indeed the execution order. Our authentication module was being executed <em>after</em> the node&nbsp;load.</p>
<h3>System.weight</h3>
<p>Some Googling revealed the nearly undocumented &#8216;weight&#8217; column in the system table. This column allows you to control the order/priority in which modules are executed.  Most module will default to 0. To increase the priority, decrease the weight; to decrease the priority, increase the weight. With 90% of our modules at 0, and, assuming that we&#8217;d always want authentication to run first (even before the Node module), we set its weight to -1. This caused the authentication to fire before the node load and  successfully load the requested&nbsp;page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.houseofding.com/2009/06/controlling-execution-order-of-drupal-modules/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
