<?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.0.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en">Prime Memberlist Filter</title>
		<description lang="en">This MOD will add a form field to the memberlist page which allows for filtering of the memberlist by username or the start of a username.</description>
		<author-notes lang="en">Support is given for both prosilver and subsilver2 templates. If you are using other templates then you might need to modify the template instructions slightly to fit your templates.

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#memberlist_filter]]></homepage>
			</author>
		</author-group>
		<mod-version>1.0.4a</mod-version>
		<installation>
			<level>easy</level>
			<time>120</time>
			<target-version>3.0.2</target-version>
		</installation>
		<history>
			<entry>
				<date>2007-09-21</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change>Initial release.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-10-01</date>
				<rev-version>1.0.0a</rev-version>
				<changelog lang="en">
					<change>Repackaged to comply with MOD Team Leader wGEric's specifications for proper packaging.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-10-22</date>
				<rev-version>1.0.0b</rev-version>
				<changelog lang="en">
					<change>Confirmed compatibility with phpBB3.0.RC7.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-07</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Fixed to work with multibyte names.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-17</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change>Added an ID to the text field to allow better styling control.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-03-11</date>
				<rev-version>1.0.3</rev-version>
				<changelog lang="en">
					<change>Fixed: the filter would not carry over to pagination pages.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-03-11</date>
				<rev-version>1.0.4</rev-version>
				<changelog lang="en">
					<change>Fixed: previous fix could cause the filter-by-first-letter option to stop working.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-02</date>
				<rev-version>1.0.4a</rev-version>
				<changelog lang="en">
					<change>Repackaged for MODX 1.2.0.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="template" href="contrib/template subsilver2.xml" lang="en">subsilver2</link>
		</link-group>
	</header>
	<action-group>

		<open src="memberlist.php">
			<edit>
				<find><![CDATA[		$first_char = request_var('first_char', '');]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Memberlist Filter -------------------------------------------//
		if(($username_filter = request_var('username_filter', '', true)) !== '')
		{
			unset($_REQUEST['username_filter']);
			unset($_POST['username_filter']);
			unset($_REQUEST['first_char']);
			unset($_POST['first_char']);
			unset($_GET['first_char']);
			$sql_where .= " AND u.username_clean " . $db->sql_like_expression(utf8_clean_string($username_filter) . $db->any_char) . ' ';
			$template->assign_var('USERNAME_FILTER', $username_filter);
		}
//-- end: Prime Memberlist Filter -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[		unset($params, $sort_params);]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Memberlist Filter -------------------------------------------//
		$mode_action_url = $pagination_url;
		if (!empty($username_filter))
		{
			$params[] = "username_filter=$username_filter";
			$pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&amp;', $params));
		}
//-- end: Prime Memberlist Filter -------------------------------------------//
]]></action>
			</edit>

			<edit>
				<find><![CDATA[}

// Output the page]]></find>
				<action type="before-add"><![CDATA[//-- mod: Prime Memberlist Filter -------------------------------------------//
		$template->assign_var('S_MODE_ACTION', $mode_action_url);
//-- end: Prime Memberlist Filter -------------------------------------------//
]]></action>
			</edit>
		</open>

		<open src="styles/prosilver/template/memberlist_body.html">
			<edit>
				<find><![CDATA[				<a href="{S_MODE_ACTION}&amp;first_char=other">#</a></strong>]]></find>
				<action type="after-add"><![CDATA[				<input type="text" name="username_filter" id="username_filter" class="inputbox" value="{USERNAME_FILTER}" />&nbsp;<input type="submit" class="button2" value="{L_GO}" />]]></action>
			</edit>
		</open>
	</action-group>
</mod>
