PDA

View Full Version : Search Custom User Profile Fields


grb123
10-01-2001, 01:33 PM
I want to add some custom user profile fields to the advanced member search. I've had a look around and it looks like a fair amount of hacking required to do this, but I was hoping maybe someone either has already done it or has an idea how I should go about it?

Admin
10-01-2001, 01:40 PM
Not really.

You will need to edit two things:
memberlist.php file
and
memberlistsearch template

For the file, you should add something like this:
if ($customfieldname!="") {
$condition.=" AND userfield.field5 LIKE '%".addslashes($customfieldname)."%' ";
}
(but change the red parts to your needs)
somewhere in this block:
if ($icq!="") {
$condition.=" AND icq LIKE '%".addslashes($icq)."%' ";
}
if ($aim!="") {
$condition.=" AND aim LIKE '%".addslashes($aim)."%' ";
}
(lots of stuff like that there, just place it between them, doesn't matter where)

Then you will need to add an input box to the template, and make the name of it customfieldname, so it'll match the code you added earlier.

Not really hard, but takes a bit time. :)

grb123
10-01-2001, 02:32 PM
As easy as that! Works perfectly, FireFly.

Once again, thank you very much!!

:)

carpman
11-26-2001, 05:29 PM
Will this search any custom user profile fields that have been added in VB control panel?



Originally posted by FireFly
Not really.

You will need to edit two things:
memberlist.php file
and
memberlistsearch template

For the file, you should add something like this:
if ($customfieldname!="") {
$condition.=" AND userfield.field5 LIKE '%".addslashes($customfieldname)."%' ";
}
(but change the red parts to your needs)
somewhere in this block:
if ($icq!="") {
$condition.=" AND icq LIKE '%".addslashes($icq)."%' ";
}
if ($aim!="") {
$condition.=" AND aim LIKE '%".addslashes($aim)."%' ";
}
(lots of stuff like that there, just place it between them, doesn't matter where)

Then you will need to add an input box to the template, and make the name of it customfieldname, so it'll match the code you added earlier.

Not really hard, but takes a bit time. :)

Admin
11-27-2001, 11:45 AM
Yes, but you must make the changes to the parts in red and add the fields to the searching template.