The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Howdy,
I have requested that vB add the ability to search by the location field since 1.x. It would be a great help to my board if users could locate others in their area. I've been told that this can be done, but it has never been described as a hack as far as I know. I would greatly appreciate any help with this. Thanks, Rick Horwitz |
#2
|
||||
|
||||
Ok this is an easy one.
In memberlistsearch template, add this: Code:
<tr> <td bgcolor="{firstaltcolor}"><normalfont><b>and Location contains</b></normalfont></td> <td bgcolor="{firstaltcolor}"><normalfont><input type="text" class="bginput" size="35" name="location" value=""></normalfont></td> </tr> Code:
</tr> <tr> <td bgcolor="{secondaltcolor}"><normalfont><b>and homepage contains</b></normalfont></td> <td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" size="35" name="homepage" value=""></normalfont></td> </tr> Code:
if ($location!="") { $condition.=" AND userfield.field2 LIKE '%".addslashes($location)."%' "; } Code:
if ($homepage!="") { $condition.=" AND homepage LIKE '%".addslashes($homepage)."%' "; } |
#3
|
|||
|
|||
Thank you so much! I really appreciate your help!
|
#4
|
|||
|
|||
One more request please...
I would also like to be able to send mass e-mails by location search crireria. There are a lot of options for sorting e-mail addresses for the mass mailing, but location is not one of them. Thanks again, Rick |
#5
|
||||
|
||||
Ok, this is a bit more complicated.
In email.php (admin folder), add this: Code:
if ($location!="") { $condition.=" AND INSTR(field2,'".addslashes($location)."')>0"; } Code:
if ($usertitle!="") { $condition.=" AND INSTR(usertitle,'".addslashes($usertitle)."')>0"; } Now replace this: Code:
$counter = $DB_site->query_first("SELECT COUNT(*) AS total FROM user WHERE $condition AND adminemail=1"); Code:
$counter = $DB_site->query_first("SELECT COUNT(*) AS total FROM user,userfield WHERE user.userid=userfield.userid AND $condition AND adminemail=1"); Code:
$users=$DB_site->query("SELECT userid,usergroupid,username,email,joindate FROM user WHERE $condition AND adminemail=1 ORDER BY userid DESC LIMIT $startat,$perpage"); Code:
$users=$DB_site->query("SELECT userid,usergroupid,username,email,joindate FROM user,userfield WHERE user.userid=userfield.userid AND $condition AND adminemail=1 ORDER BY userid DESC LIMIT $startat,$perpage"); Code:
makehiddencode("homepage",$homepage); Code:
makehiddencode("location",$location); Code:
makeinputcode("and location contains","location"); [code] makeinputcode("and homepage contains","homepage"); (Note: this appears *twice*) And lastly replace this: Code:
$users=$DB_site->query("SELECT email FROM user WHERE $condition AND adminemail=1"); Code:
$users=$DB_site->query("SELECT email FROM user,userfield WHERE user.userid=userfield.userid AND $condition AND adminemail=1"); |
#6
|
|||
|
|||
Want to add a small twist to the above if you can. I want to search by location but just as part of the standard search query.
If someone enters "black hat texas" in the search query it will look for all posts that have "black hat texas" in them or all of the 3 terms either in the post or location field. So if I wanted to find all the black hats in texas I could just type that in and even if the text "black hat" appeared in the post and texas only appeared in the location field it would still show up. Alternatively if easier add a second AND search box next to the standard query box on the regular main search page to put a location in if required. So "black hat" would go in the search box and "texas" would go into the box adjacent to it. Search for ___________ in this location ______________ If you know how to do this could you PLEASE post it here. I did the hack on the memberlist search but really need it on the main search to be truly useful to our board and I know lots of people need this search hack too. Thanks so much for any help you can provide! |
#7
|
|||
|
|||
Still working on this one...can one of you experts maybe point me in the right direction? I'm thinking you add another input field next to the search box such as "location" and then is it just a matter of extending the mySQL query along with some joins to match the results of the search to the users who made the posts that have the specific location in their custom user field?
Is it more involved than this or I am headed down the good path here? Thanks. |
#8
|
|||
|
|||
this is an old thread, has this template changed? cause i can't find it but would love this feature. help??
memberlistsearch template --------------- Added [DATE]1200697168[/DATE] at [TIME]1200697168[/TIME] --------------- btw, i'm in version 3.6.3 and would love to add this! |
#9
|
|||
|
|||
pretty please??
|
#10
|
|||
|
|||
This thread is most likely about vBulletin 2.x, instructions given here will not work on a later version.
I suggest you start a new thread with your question. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|