punbb/admin/users.php
changeset 9 a932ce8c4827
parent 7 98bbc533541c
--- a/punbb/admin/users.php	Sun Apr 06 00:35:38 2008 -0400
+++ b/punbb/admin/users.php	Sun Jun 15 01:42:31 2008 -0400
@@ -748,8 +748,9 @@
 	$like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
 	while (list($key, $input) = @each($form))
 	{
+    $e = ( $key == 'username' ) ? 'e' : '';
 		if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note')))
-			$conditions[] = 'u.'.$pun_db->escape($key).' '.$like_command.' \''.$pun_db->escape(str_replace('*', '%', $input)).'\'';
+			$conditions[] = $e . 'u.'.$pun_db->escape($key).' '.$like_command.' \''.$pun_db->escape(str_replace('*', '%', $input)).'\'';
 	}
 
 	if ($posts_greater != '')
@@ -769,16 +770,23 @@
 
 	// Find any users matching the conditions
 	$query = array(
-		'SELECT'	=> 'u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title',
-		'FROM'		=> 'users AS u',
+		'SELECT'	=> 'u.id, eu.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title',
+		'FROM'		=> $pun_db->prefix . 'users AS u',
 		'JOINS'		=> array(
 			array(
-				'LEFT JOIN'		=> 'groups AS g',
+				'LEFT JOIN'		=> $pun_db->prefix . 'groups AS g',
 				'ON'			=> 'g.g_id=u.group_id'
-			)
+			),
+      array(
+        'LEFT JOIN' => table_prefix . 'users AS eu',
+        'ON' => 'eu.user_id = u.id'
+      )
 		),
 		'WHERE'		=> 'u.id>1 AND '.implode(' AND ', $conditions),
-		'ORDER BY'	=> $pun_db->escape($order_by).' '.$pun_db->escape($direction)
+		'ORDER BY'	=> $pun_db->escape($order_by).' '.$pun_db->escape($direction),
+    'PARAMS' => array(
+      'NO_PREFIX' => ''
+    )
 	);
 
 	($hook = get_hook('aus_qr_find_users')) ? eval($hook) : null;