<?php 
$arrFields = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
$arrFieldCaptions = array('All fields', 'Username', 'Group', 'Email', $adminConfig['custom1'], $adminConfig['custom2'], $adminConfig['custom3'], $adminConfig['custom4'], 'Comments');
echo htmlSelect('searchField', $arrFields, $arrFieldCaptions, $searchField);
?>
							</td>
						<td valign="bottom" rowspan="2">
							<input type="submit" value="Find">
							<input type="button" value="Reset" onClick="window.location='pageViewMembers.php';">
							</td>
						</tr>
					<tr>
						<td align="center">
							Group
							<?php 
echo htmlSQLSelect("groupID", "select groupID, name from membership_groups order by name", $groupID);
?>
							&nbsp; &nbsp; &nbsp; 
							Status
							<?php 
$arrFields = array(0, 1, 2, 3);
$arrFieldCaptions = array('Any', 'Waiting approval', 'Active', 'Banned');
echo htmlSelect("status", $arrFields, $arrFieldCaptions, $status);
?>
							</td>
						</tr>
					</table>
				</form>
			</td>
		</tr>
	<tr>
				<div class="formFieldCaption">Owner group</div>
				</td>
			<td align="left" class="tdFormInput">
				<?php 
echo htmlSQLSelect('groupID', "select g.groupID, g.name from membership_groups g order by name", $groupID);
?>
				<a href="#" onClick="window.location='pageViewRecords.php?groupID='+escape(document.getElementById('groupID').value);"><img src="images/data_icon.gif" alt="View all records by this group" title="View all records by this group" border="0"></a>
				</td>
			</tr>
		<tr>
			<td align="right" class="tdFormCaption" valign="top">
				<div class="formFieldCaption">Owner member</div>
				</td>
			<td align="left" class="tdFormInput" width="460">
				<?php 
echo htmlSQLSelect('memberID', "select lcase(memberID), lcase(memberID) from membership_users where groupID='{$groupID}' order by memberID", $memberID);
?>
				<a href="#" onClick="window.location='pageViewRecords.php?memberID='+escape(document.getElementById('memberID').value);"><img src="images/data_icon.gif" alt="View all records by this member" title="View all records by this member" border="0"></a>
				<br />If you want to switch ownership of this record to a member of another group,
				you must change the owner group and save changes first.
				</td>
			</tr>
		<tr>
			<td align="right" class="tdFormCaption" valign="top">
				<div class="formFieldCaption">Record created on</div>
				</td>
			<td align="left" class="tdFormInput">
				<?php 
echo $dateAdded;
?>
				</td>
    ?>
					</td>
				</tr>
			<?php 
    if (sqlValue("select count(1) from membership_users where groupID='{$destinationGroupID}'") > 0) {
        $destinationHasMembers = TRUE;
        ?>
					<tr>
						<td class="tdCell" colspan="2">
							<input type="radio" name="moveMembers" id="dontMoveMembers" value="0" <?php 
        echo $moveMembers ? "" : "checked";
        ?>
>
							Move data records to this member:
							<?php 
        echo htmlSQLSelect("destinationMemberID", "select lcase(memberID), lcase(memberID) from membership_users where groupID='{$destinationGroupID}' order by memberID", $destinationMemberID);
        ?>
							</td>
						</tr>
					<?php 
    } else {
        $destinationHasMembers = FALSE;
    }
    if (!$noMove) {
        ?>
					<tr>
						<td class="tdCell" colspan="2">
							<input type="radio" name="moveMembers" id="moveMembers" value="1" <?php 
        echo $moveMembers || !$destinationHasMembers ? "checked" : "";
        ?>
>
        @mail($adminConfig['senderEmail'], '[real estate] New member signup', "A new member has signed up for real estate.\n\nMember name: {$memberID}\nMember group: " . sqlValue("select name from membership_groups where groupID='{$groupID}'") . "\nMember email: {$email}\nIP address: {$_SERVER['REMOTE_ADDR']}\nCustom fields:\n" . ($adminConfig['custom1'] ? "{$adminConfig['custom1']}: {$custom1}\n" : '') . ($adminConfig['custom2'] ? "{$adminConfig['custom2']}: {$custom2}\n" : '') . ($adminConfig['custom3'] ? "{$adminConfig['custom3']}: {$custom3}\n" : '') . ($adminConfig['custom4'] ? "{$adminConfig['custom4']}: {$custom4}\n" : ''), "From: {$adminConfig['senderEmail']}\r\n\r\n");
    } elseif ($adminConfig['notifyAdminNewMembers'] >= 1 && $needsApproval) {
        @mail($adminConfig['senderEmail'], '[real estate] New member awaiting approval', "A new member has signed up for real estate.\n\nMember name: {$memberID}\nMember group: " . sqlValue("select name from membership_groups where groupID='{$groupID}'") . "\nMember email: {$email}\nIP address: {$_SERVER['REMOTE_ADDR']}\nCustom fields:\n" . ($adminConfig['custom1'] ? "{$adminConfig['custom1']}: {$custom1}\n" : '') . ($adminConfig['custom2'] ? "{$adminConfig['custom2']}: {$custom2}\n" : '') . ($adminConfig['custom3'] ? "{$adminConfig['custom3']}: {$custom3}\n" : '') . ($adminConfig['custom4'] ? "{$adminConfig['custom4']}: {$custom4}\n" : ''), "From: {$adminConfig['senderEmail']}\r\n\r\n");
    }
    // hook: member_activity
    if (function_exists('member_activity')) {
        $args = array();
        member_activity(getMemberInfo($memberID), $needsApproval ? 'pending' : 'automatic', $args);
    }
    // redirect to thanks page
    $redirect = $needsApproval ? '' : '?redir=1';
    redirect("membership_thankyou.php{$redirect}");
    exit;
}
// drop-down of groups allowing self-signup
$groupsDropDown = preg_replace('/<option.*?value="".*?><\\/option>/i', '', htmlSQLSelect('groupID', "select groupID, concat(name, if(needsApproval=1, ' *', ' ')) from membership_groups where allowSignup=1 order by name", $cg == 1 ? sqlValue("select groupID from membership_groups where allowSignup=1 order by name limit 1") : 0));
$groupsDropDown = str_replace('<select ', '<select class="form-control" ', $groupsDropDown);
?>

<?php 
if (!$noSignup) {
    ?>
	<div class="row">
		<div class="hidden-xs col-sm-4 col-md-6 col-lg-8" id="signup_splash">
			<!-- customized splash content here -->
		</div>

		<div class="col-sm-8 col-md-6 col-lg-4">
			<div class="panel panel-success">

				<div class="panel-heading">
</div>
				</td>
			<td align="left" class="TableBody">
				<input type="text" name="email" value="" size="40" class="TextBox">
				</td>
			</tr>
		<tr>
			<td align="right" class="TableHeader" valign="top">
				<div class="TableHeader"><?php 
    echo $Translation['group'];
    ?>
</div>
				</td>
			<td align="left" class="TableBody" width="400">
				<?php 
    echo htmlSQLSelect('groupID', "select groupID, concat(name, if(needsApproval=1, ' *', ' ')) from membership_groups where allowSignup=1 order by name", $cg == 1 ? sqlValue("select groupID from membership_groups where allowSignup=1 order by name limit 1") : 0);
    ?>
				<br /><?php 
    echo $Translation['groups *'];
    ?>
				</td>
			</tr>
	<?php 
    if ($adminConfig['custom1'] != '') {
        ?>
		<tr>
			<td align="right" class="TableHeader" valign="top">
				<div class="TableHeader"><?php 
        echo $adminConfig['custom1'];
        ?>
</div>