<?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></description>
	<lastBuildDate>Thu, 05 Jan 2012 03:08:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Controlling execution order of Drupal modules</title>
		<link>http://www.houseofding.com/2009/06/controlling-execution-order-of-drupal-modules/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=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 ‘stuff that breaks at work’ blog, but I fear that if I don’t document these, they’ll likely bite me again. And, if the solutions help someone else, then that’s great. Our team recently launched a large website in Drupal that uses many home-grown modules. I discovered that with certain [...]]]></description>
			<content:encoded><![CDATA[<p>So lately, this had become a ‘stuff that breaks at work’ blog, but I fear that if I don’t document these, they’ll likely bite me again. And, if the solutions help someone else, then that’s 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’d developed a module that interacts with the University’s single sign-on service and automatically creates or loads a Drupal user.</p>
<h3>Order 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’t happening. The user would click a protected link, login, and then encounter the default 403 page: ‘Access Denied.’ 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 load.</p>
<h3>System.weight</h3>
<p>Some Googling revealed the nearly undocumented ‘weight’ 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’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 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>

