<?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; modification</title>
	<atom:link href="http://www.cs278.org/blog/tag/modification/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 Hook to remove success messages</title>
		<link>http://www.cs278.org/blog/2010/02/16/phpbb-hook-to-remove-success-messages/</link>
		<comments>http://www.cs278.org/blog/2010/02/16/phpbb-hook-to-remove-success-messages/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:32:59 +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[tip]]></category>

		<guid isPermaLink="false">http://www.cs278.org/blog/?p=531</guid>
		<description><![CDATA[Time for another phpBB hook, this time the aim is to remove the messages which irritate some people when a post has been made and instead redirect the user immediately to the default choice. A few considerations had to be &#8230; <a href="http://www.cs278.org/blog/2010/02/16/phpbb-hook-to-remove-success-messages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Time for another <a href="http://www.phpbb.com/" rel="external">phpBB</a> <a href="http://www.cs278.org/blog/tag/hook/">hook</a>, this time the aim is to remove the messages which irritate some people when a post has been made and instead redirect the user immediately to the default choice. A few considerations had to be made with this, firstly the administration panel is off limits as this uses messages for success and failure in some places. Secondly any page which goes back to itself by default is made confusing if there isn&#8217;t a confirmation, so these aren&#8217;t automatically redirected; a good example of this being the UCP preferences.<span id="more-531"></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>.) So, basically you need to drop the below file into your <code>includes/hooks/</code> directory and purge the board cache, job done!</p>
<p><script src="http://gist.github.com/305915.js?file=hook_disable-delayed-redirects.php"></script><noscript>
<p><a href="http://gist.github.com/305915" rel="external">includes/hooks/hook_disable-delayed-redirects.php</a></p>
<p></noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cs278.org/blog/2010/02/16/phpbb-hook-to-remove-success-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another phpBB Hook</title>
		<link>http://www.cs278.org/blog/2009/04/05/another-phpbb-hook/</link>
		<comments>http://www.cs278.org/blog/2009/04/05/another-phpbb-hook/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 14:56:11 +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>

		<guid isPermaLink="false">http://www.cs278.org/blog/?p=475</guid>
		<description><![CDATA[Further to my entry last month about a phpBB Hook to disable the post queue for certain users, I&#8217;ve written a really quick one to enable phpBB&#8217;s debugging mode for founder users. Debug mode is usually enabled by using the &#8230; <a href="http://www.cs278.org/blog/2009/04/05/another-phpbb-hook/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Further to my <a href="http://www.cs278.org/blog/2009/03/15/phpbb-post-queue/">entry</a> last month about a phpBB Hook to disable the post queue for certain users, I&#8217;ve written a really quick one to enable phpBB&#8217;s debugging mode for founder users. Debug mode is usually enabled by using the constants <code>DEBUG</code> and <code>DEBUG_EXTRA</code> in the configuration file but these can be defined anywhere. The only downside debugging information will only be available after the hook is included, however this is sufficient to get the page generation time, memory usage etc. in the footer which is what I was after. <span id="more-475"></span></p>
<p><a href="http://gist.github.com/90448" rel="external">includes/hooks/hook_enable-debug-for-founders.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 enables the debug mode for founders
 */
function hook_enable_debug_for_founders(&#038;$hook)
{
	global $user;

	if ($user-&gt;data['user_type'] == USER_FOUNDER)
	{
		// Be careful when defining the constants

		if (!defined('DEBUG'))
		{
			define('DEBUG', true);
		}

		if (!defined('DEBUG_EXTRA'))
		{
			define('DEBUG_EXTRA', true);
		}
	}
}

$phpbb_hook-&gt;register('phpbb_user_session_handler', 'hook_enable_debug_for_founders');</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cs278.org/blog/2009/04/05/another-phpbb-hook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

