<?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>Chris&#039; Blog &#187; xmedia</title>
	<atom:link href="http://www.cs278.org/blog/tag/xmedia/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cs278.org/blog</link>
	<description>“A metal loving, web developing, open source contributor.”</description>
	<lastBuildDate>Sun, 03 Apr 2011 14:36:34 +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>phpBB Post Queue</title>
		<link>http://www.cs278.org/blog/2009/03/15/phpbb-post-queue/</link>
		<comments>http://www.cs278.org/blog/2009/03/15/phpbb-post-queue/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 17:58:06 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[phpBB]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[modification]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[xmedia]]></category>

		<guid isPermaLink="false">http://www.cs278.org/blog/?p=463</guid>
		<description><![CDATA[In phpBB 3.0.3 we added the possibility to queue posts of users who had a post count lower than an administrator defined threshold, this works very well at keeping spam out of the public eye on your board. But on &#8230; <a href="http://www.cs278.org/blog/2009/03/15/phpbb-post-queue/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.phpbb.com/community/viewtopic.php?f=14&#038;t=1292765" rel="external">phpBB 3.0.3</a> we added the possibility to queue posts of users who had a post count lower than an administrator defined threshold, this works very well at keeping spam out of the public eye on your board. But on the <a href="http://xmedia.ex.ac.uk/forums/" rel="external">board</a> I administer which is primarily for <a href="http://www.exeter.ac.uk/" rel="external">university</a> students who all have their own university e-mail address it penalises new users who I as the board administrator trust. To get around this, I will be applying a small modification to our board during the next maintenance period which I thought I will share with you. <span id="more-463"></span></p>
<p>This change exploits phpBB&#8217;s <a href="http://code.phpbb.com/svn/phpbb/branches/phpBB-3_0_0/phpBB/docs/hook_system.html">hook system</a> which allows us to execute custom code in certain phpBB functions/methods without modifying any files. To do this we need to create a new file in our phpBB installation in the <code>includes/hooks/</code> directory, the file name must begin with <code>hook_</code> and end with your PHP extension (usually <code>.php</code>.)</p>
<p><a href="http://gist.github.com/79491">includes/hooks/hook_trusted-users.php</a>:</p>
<pre>&lt;?php

/**
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details.
 */

if (!defined('IN_PHPBB'))
{
	exit;
}

/**
 * This hook disables the post queue for accounts registered with a trusted
 * e-mail address.
 */
function hook_trusted_users(&#038;$hook)
{
	global $config, $user;

	/**
	 * Skip when the queue is disabled, or this is an administration
	 * session so we don't break the ACP, chances are that administrators
	 * have moderation permissions or more posts than required to post any way.
	 */
	if ($config['enable_queue_trigger'] &#038;&#038; !$user-&gt;data['session_admin'] &#038;&#038; preg_match('#@example\.com$#i', $user-&gt;data['user_email']))
	{
		$config['enable_queue_trigger'] = 0; // Disable the post queue for our trusted users
	}
}

$phpbb_hook-&gt;register('phpbb_user_session_handler', 'hook_trusted_users');</pre>
<p>Once you have dropped the file in place you will need to purge your cache, or just manually delete <code>cache/data_hooks.php</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cs278.org/blog/2009/03/15/phpbb-post-queue/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

