<?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.5.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.2b</mod-version>
		<installation>
			<level>easy</level>
			<time>180</time>
			<target-version>3.0.8</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 anonymous 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>
			<entry>
				<date>2009-07-27</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Fixed: when a user was removed from the banned or suspended users group, the user would retain the rank associated with that group.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-01-10</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change>Remove stale bans whenever a new session is created.</change>
					<change>Log entries now use the group names specified in the language file instead of the name in the database.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-04-08</date>
				<rev-version>1.0.2a</rev-version>
				<changelog lang="en">
					<change>Updated the database install file so that duplicate groups won't get created if attempting a reinstall without first doing an uninstall.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-06-24</date>
				<rev-version>1.0.2b</rev-version>
				<changelog lang="en">
					<change>Added a Polish translation.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="language" href="contrib/language - fr.xml" realname="fr" lang="en">French</link>
			<link type="language" href="contrib/language - pt.xml" realname="pt" lang="en">Portuguese</link>
			<link type="language" href="contrib/language - pl.xml" realname="pl" lang="en">Polish</link>
			<link type="contrib" href="contrib/update 1.0.0 to 1.0.1.xml" lang="en">Update 1.0.0 to 1.0.1</link>
			<link type="contrib" href="contrib/update 1.0.1 to 1.0.2.xml" lang="en">Update 1.0.1 to 1.0.2</link>
		</link-group>
	</header>
	<action-group>
		<php-installer>update_db.php</php-installer>
		<copy>
			<file from="root/update_db.php" to="update_db.php" />
			<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>

		<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[		// Is user banned? Are they excluded? Won't return on ban, exists within method]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Ban to Group -----------------------------------------------//
		// Delete stale bans
		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[Make sure to delete the install_db.php file once it has been successfully executed.

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'.

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>

