The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Memberlist Search
Can anyone please tell me how to make the following code to a partial serach for a member instead of having to have the full member name first?
Code:
if ($action=="quickfind") { $usernamecheckq = $DB_site->query("SELECT userid FROM user WHERE username='".addslashes(htmlspecialchars($membername))."'"); $usernamecheck = mysql_fetch_array($usernamecheckq); if (!$usernamecheck[userid]) { eval("standarderror(\"".gettemplate("error_invalidusername")."\");"); exit; } $goto="member.php?s=$session[sessionhash]&action=getinfo&userid=$usernamecheck[userid]"; eval("standardredirect(\"".gettemplate("redirect_memberfound")."\",\"$goto\");"); } |
#2
|
||||
|
||||
instead of username='".addslashes($membername)."'
use username LIKE '%".addslashes($membername)."%' |
#3
|
||||
|
||||
Ok, that worked, thank you. Now, how can I pull out the full username from the search and display it in the "redirect_memberfound" template. If I use "$membername" like it is now, it pulls out what was in the search string (like boofos ba) instead of the full username. Also, is there a way to have it bring up a listing of just the names found in the search so the user can pick from them?
Quote:
|
#4
|
||||
|
||||
you have to construct a while loop to get all usernames...
to get the correct username instead of $membername use $usernamecheck[username] |
#5
|
||||
|
||||
Ok, but will that do an excessive amount of queries then?
I tried using $usernamecheck[username] and all I get is a blank spot where the name should be. Quote:
|
#6
|
||||
|
||||
no, no great ammount of queries, just one query and then just fetcharrays
oh sorry, you must include ,username in the query: SELECT userid,username FROM... |
#7
|
||||
|
||||
Thanks, Stefan, now it brings up the username ok.
How do I get it to bring up the user alphabetically instead of going by the userid? Right now a user with a Marj in the name comes up before an Marc when I type Mar. It is going by when they joined right now. Quote:
|
#8
|
||||
|
||||
add a "ORDER BY username" into the query
|
#9
|
||||
|
||||
I take it from my DB error, I put it in the wrong place?
PHP Code:
Quote:
|
#10
|
||||
|
||||
Code:
SELECT userid,username FROM user WHERE username LIKE '%".addslashes(htmlspecialchars($membername))."%' ORDER BY username |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|