<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./contrib/xsl/modx.prosilver.en.xsl"?>
<!-- 
	NOTICE: Please open this file in your web browser. If presented with a security warning, you may safely tell it to allow the blocked content.
-->
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.1.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en">Prime Ban to Group</title>
		<description lang="en">Automatically moves users into a special group when they are banned. This allows you to visually indicate that a user has been banned through the use of group attributes, such as a custom rank image.  Users will be removed from the group when they are manually unbanned or when their temporary ban has ended.</description>
		<author-notes lang="en">The check for removing users from a temporary ban will occur when any user logs in, or when a user is manually banned or unbanned.

The groups that are created will be set as special pre-defined groups. If you would prefer them to be a normal groups, then you will need to create them through the Administration Control Panel instead of executing the provided SQL statements. See the Do-It-Yourself instructions at the bottom of the page for more information.

Creating, maintaining, and updating MODs requires a lot of time and effort, so if you like this MOD and have the desire to express your thanks through donations, that would be greatly appreciated. My Paypal ID is primehalo@gmail.com, or contact me for my mailing address. The suggested donation amount for this MOD is $2.00 (but any amount will help).</author-notes>
		<author-group>
			<author>
				<realname>Ken F. Innes IV</realname>
				<email>primehalo@gmail.com</email>
				<username>primehalo</username>
				<homepage><![CDATA[http://www.absoluteanime.com/admin/mods.htm#ban_to_group]]></homepage>
			</author>
		</author-group>
		<mod-version>1.0.0</mod-version>
		<installation>
			<level>easy</level>
			<time>180</time>
			<target-version>3.0.2</target-version>
		</installation>
		<history>
			<entry>
				<date>2008-02-06</date>
				<rev-version>0.0.0</rev-version>
				<changelog lang="en">
					<change>Initial release.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-02-07</date>
				<rev-version>0.0.0a</rev-version>
				<changelog lang="en">
					<change>Included a Portuguese translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-02-27</date>
				<rev-version>0.0.1</rev-version>
				<changelog lang="en">
					<change>When automatically removing users from a group, the admin log would also show that bots and the annonymous user had been removed from the group, even though they obviously never belonged to the group.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-05-19</date>
				<rev-version>0.0.1a</rev-version>
				<changelog lang="en">
					<change>Added French language translation.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-03</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Repackaged for MODX 1.2.0.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="language" href="contrib/language fr.xml" lang="en">French</link>
			<link type="language" href="contrib/language pt.xml" lang="en">Portuguese</link>
		</link-group>
	</header>
	<action-group>
		<copy>
			<file from="root/language/en/mods/prime_ban_to_group.php" to="language/en/mods/prime_ban_to_group.php" />
			<file from="root/includes/prime_ban_to_group.php" to="includes/prime_ban_to_group.php" />
		</copy>

		<sql><![CDATA[INSERT INTO phpbb_groups (group_type, group_founder_manage, group_name, group_desc, group_desc_bitfield, group_desc_options, group_desc_uid, group_display, group_avatar, group_avatar_type, group_avatar_width, group_avatar_height, group_rank, group_colour, group_sig_chars, group_receive_pm, group_message_limit, group_legend) VALUES (3, 0, 'BANNED_USERS', '', '', 7, '', 0, '', 0, 0, 0, 0, '', 0, 0, 0, 0);]]></sql>
		<sql><![CDATA[INSERT INTO phpbb_groups (group_type, group_founder_manage, group_name, group_desc, group_desc_bitfield, group_desc_options, group_desc_uid, group_display, group_avatar, group_avatar_type, group_avatar_width, group_avatar_height, group_rank, group_colour, group_sig_chars, group_receive_pm, group_message_limit, group_legend) VALUES (3, 0, 'SUSPENDED_USERS', '', '', 7, '', 0, '', 0, 0, 0, 0, '', 0, 0, 0, 0);]]></sql>

		<open src="includes/functions_user.php">
			<edit>
				<comment lang="en">The following line appears twice in this file. This is the first occurrence.</comment>
				<find><![CDATA[	// Delete stale bans]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
	global $phpbb_root_path, $phpEx;
	include "$phpbb_root_path/includes/prime_ban_to_group.$phpEx";
	$prime_ban_to_group = new prime_ban_to_group(null, 'unban');
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
			<edit>
				<find><![CDATA[			if (isset($sql_where) && $sql_where)]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
			$prime_ban_to_group->ban_to_group((isset($sql_in) ? $sql_in : $banlist_ary), $ban_end, $mode);
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
			<edit>
				<comment lang="en">The following line appears twice in this file. This is the second occurrence.</comment>
				<find><![CDATA[	// Delete stale bans]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
	global $phpbb_root_path, $phpEx;
	include "$phpbb_root_path/includes/prime_ban_to_group.$phpEx";
	$prime_ban_to_group = new prime_ban_to_group(null, 'unban');
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
			<edit>
				<find><![CDATA[		// Grab details of bans for logging information later]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
		$prime_ban_to_group->ban_to_group($unban_sql, 'unban', $mode);
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
		</open>

		<open src="includes/session.php">
			<edit>
				<find><![CDATA[		$banned = false;
		$cache_ttl = 3600;]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
		global $phpbb_root_path, $phpEx;
		include "$phpbb_root_path/includes/prime_ban_to_group.$phpEx";
		$prime_ban_to_group = new prime_ban_to_group(null, 'unban');
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
			<edit>
				<find><![CDATA[		// Does the user need to change their password? If so, redirect to the]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
		$this->add_lang('mods/prime_ban_to_group');
//-- end: Prime Ban to Group -----------------------------------------------//
]]></action>
			</edit>
		</open>
		<diy-instructions lang="en"><![CDATA[By default, users with permanent bans will be placed in a separate group
(Banned users) from users with temporary bans (Suspended users). If you desire 
to use only a single group, open "includes/prime_ban_to_group.php" and change
'SUSPENDED_USERS' to 'BANNED_USERS'.

As an alternative to manually executing the SQL statements, you can use the
included "db_install.php" (located in the contrib directory). Simply copy the
file to the root directory of your phpbb3 install, and point your web browser
to the address. Make sure you are logged in as an administrator before you do
this, and make sure to delete the file once you're done.

The groups that are created using the supplied SQL will be special groups.
If you would prefer them to be normal groups, go to "Administration Control 
Panel", "Users and Groups", and create two new groups: "Banned users" and 
"Suspended users". Next, open the "includes/prime_ban_to_group.php" file and
change 'BANNED_USERS' and 'SUSPENDED_USERS' to the names of your new groups.

Now that banned users are in specific user groups, you can set up attributes
such as a custom rank to visually indicate which users have been banned. To 
create a rank, go to the "Administration Control Panel", "Users and Groups", 
"Manage Ranks", and click "Add new rank". I have provided two graphics in the
contrib directory for use as rank images.

Once you have your ranks set up, you can now associate them with the groups.
Go to "Administration Control Panel", "Users and Groups", "Manage Groups" and
click "Settings" next to the group that will receive the rank. Scroll down
until you see the "Group rank" option, and set this to the rank you previously
created.
]]></diy-instructions>
	</action-group>
</mod>
