Help to change code in Search in userprofiles mod, please.
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Help to change code in Search in userprofiles mod, please.
Your phpBB Version: Vanilla phpBB 2.0.18
MODs: No
Your knowledge: Basic Knowledge
Boardlink: [url]http://[/url]
PHP Version:
MySQL Version:
What have you done before the problem was there?
nothing
What have you already tryed to solve the problem?
searching all over the net for a solution, but I cannot figure out how to change the code.
Description and Message
Hello OXPUS!
First of all thank you very much for the wonderful Search in userprofiles mod. I am wondering if you would like to help me to make a change that many of my members would like to see, but I can't figure out how to change the code.
The issue: now, when you search for two or more words, the result is users with any of the words in their profile fields.
(ie, searchword1 OR searchword2)
Would you like to help me to change the code so that it returns results for users with all words in their profile fields.
(ie, searchword1 AND searchword2)
Thank you very much in advance.
Kind Regards,
Michael Fahraeus
MODs: No
Your knowledge: Basic Knowledge
Boardlink: [url]http://[/url]
PHP Version:
MySQL Version:
What have you done before the problem was there?
nothing
What have you already tryed to solve the problem?
searching all over the net for a solution, but I cannot figure out how to change the code.
Description and Message
Hello OXPUS!
First of all thank you very much for the wonderful Search in userprofiles mod. I am wondering if you would like to help me to make a change that many of my members would like to see, but I can't figure out how to change the code.
The issue: now, when you search for two or more words, the result is users with any of the words in their profile fields.
(ie, searchword1 OR searchword2)
Would you like to help me to change the code so that it returns results for users with all words in their profile fields.
(ie, searchword1 AND searchword2)
Thank you very much in advance.
Kind Regards,
Michael Fahraeus
Zuletzt geändert von fahraeus am Do 01.Dez, 2005 17:34, insgesamt 1-mal geändert.
- oxpus
- Administrator
- Beiträge: 28735
- Registriert: Mo 27.Jan, 2003 22:13
- Wohnort: Bad Wildungen
- Kontaktdaten:
For this you can try this:
Find in the code block from my MOD
and replace this with
Find in the code block from my MOD
Code: Alles auswählen
for ( $i = 0; $i < count($search_profile_string); $i++)
{
foreach($split_search as $search_word)
{
if ( @eregi($search_word, $search_profile_string[$i]) )
{
$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
}
}
}Code: Alles auswählen
if ( @eregi($search_keywords, $search_profile_string[$i]) )
{
$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
}Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
- oxpus
- Administrator
- Beiträge: 28735
- Registriert: Mo 27.Jan, 2003 22:13
- Wohnort: Bad Wildungen
- Kontaktdaten:
Okay, then try this:
Code: Alles auswählen
#
#-----[ FIND ]----- // The ORIGINAL Code Block!!!
#
for ( $i = 0; $i < count($search_profile_string); $i++)
{
foreach($split_search as $search_word)
{
if ( @eregi($search_word, $search_profile_string[$i]) )
{
$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
}
}
}
#
#-----[ REPLACE WITH ]-----
#
for ( $i = 0; $i < count($search_profile_string); $i++)
{
if ( @eregi($search_profile, $search_profile_string[$i]) )
{
$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
}
}Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
It seems closer. I changed to code above.
I created an account named Testaccount, and in profile entered
Location: location1
Occupation: occupation1
Interests: interest1, interest2, interest3
Now if you search for any single word above it works
But if you search for multiple words only ONE combination works:
"occupation1 location1" = Testaccount (wow it works)
but... strange thing is, ANY other combination yields no result. Even if you just change the order:
"location1 occupation1" (just different order, no result)
I am very grateful that you are helping me. I hope we can figure it out in the end.
I created an account named Testaccount, and in profile entered
Location: location1
Occupation: occupation1
Interests: interest1, interest2, interest3
Now if you search for any single word above it works
But if you search for multiple words only ONE combination works:
"occupation1 location1" = Testaccount (wow it works)
but... strange thing is, ANY other combination yields no result. Even if you just change the order:
"location1 occupation1" (just different order, no result)
I am very grateful that you are helping me. I hope we can figure it out in the end.
- oxpus
- Administrator
- Beiträge: 28735
- Registriert: Mo 27.Jan, 2003 22:13
- Wohnort: Bad Wildungen
- Kontaktdaten:
Okay, try this code block (the same place):
Code: Alles auswählen
for ( $i = 0; $i < count($search_profile_string); $i++)
{
$j = 0;
foreach($split_search as $search_word)
{
if ( @eregi($search_word, $search_profile_string[$i]) )
{
$j++;
}
}
if ($j == sizeof($split_search))
{
$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
}
}Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!