# HG changeset patch # User Dan # Date 1188183158 14400 # Node ID f7750e454168afa150d8fd761403aecfc45457fb # Parent 9c17aacd5515d137680f0af2812cb3214dc6e982 Added search function for memberlist diff -r 9c17aacd5515 -r f7750e454168 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Sun Aug 26 20:55:12 2007 -0400 +++ b/plugins/SpecialUserFuncs.php Sun Aug 26 22:52:38 2007 -0400 @@ -1092,14 +1092,6 @@ $startletter_sql = '([^a-z])'; } - // determine number of rows - $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE u.username REGEXP "^' . $startletter_sql . '" AND u.username != "Anonymous";'); - if ( !$q ) - $db->_die(); - - $num_rows = $db->numrows(); - $db->free_result(); - // offset $offset = ( isset($_GET['offset']) && strval(intval($_GET['offset'])) === $_GET['offset']) ? intval($_GET['offset']) : 0; @@ -1144,23 +1136,57 @@ 'email' => array($formatter, 'email') ); + // User search + if ( isset($_GET['finduser']) ) + { + $finduser = str_replace(array( '%', '_'), + array('\\%', '\\_'), + $_GET['finduser']); + $finduser = str_replace(array('*', '?'), + array('%', '_'), + $finduser); + $finduser = $db->escape($finduser); + $username_where = 'u.username LIKE "' . $finduser . '"'; + $finduser_url = 'finduser=' . rawurlencode($_GET['finduser']) . '&'; + } + else + { + $username_where = 'u.username REGEXP "^' . $startletter_sql . '"'; + $finduser_url = ''; + } + // Column markers $headings = '
Sorry - no users with usernames that start with that letter could be found.
'; + echo ( isset($_GET['finduser']) ) ? 'Sorry - no users that matched your query could be found. Please try some different search terms.
' : 'Sorry - no users with usernames that start with that letter could be found.
'; } else {