Skip to content

Instantly share code, notes, and snippets.

@cs278
Created March 15, 2009 17:50
Show Gist options
  • Save cs278/79491 to your computer and use it in GitHub Desktop.
Save cs278/79491 to your computer and use it in GitHub Desktop.
phpBB Hook - Disables post queue for trusted users.
<?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(&$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'] && !$user->data['session_admin'] && preg_match('#@example\.com$#i', $user->data['user_email']))
{
$config['enable_queue_trigger'] = 0; // Disable the post queue for our trusted users
}
}
$phpbb_hook->register('phpbb_user_session_handler', 'hook_trusted_users');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment