Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2001, 03:14 AM
Rick Rick is offline
 
Join Date: Nov 2001
Location: Wittmann, AZ
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #2  
Old 11-21-2001, 07:53 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
right after this:
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>
Now in memberlist.php, add this:
Code:
    if ($location!="") {
      $condition.=" AND userfield.field2 LIKE '%".addslashes($location)."%' ";
    }
right after this:
Code:
    if ($homepage!="") {
      $condition.=" AND homepage LIKE '%".addslashes($homepage)."%' ";
    }
(if the ID of your location field isn't 2, change it in the code you add)
Reply With Quote
  #3  
Old 11-21-2001, 02:37 PM
Rick Rick is offline
 
Join Date: Nov 2001
Location: Wittmann, AZ
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much! I really appreciate your help!
Reply With Quote
  #4  
Old 11-21-2001, 09:08 PM
Rick Rick is offline
 
Join Date: Nov 2001
Location: Wittmann, AZ
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 11-22-2001, 11:55 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, this is a bit more complicated.

In email.php (admin folder), add this:
Code:
    if ($location!="") {
      $condition.=" AND INSTR(field2,'".addslashes($location)."')>0";
    }
after this:
Code:
    if ($usertitle!="") {
      $condition.=" AND INSTR(usertitle,'".addslashes($usertitle)."')>0";
    }
(Note: this appears *twice*)

Now replace this:
Code:
	$counter = $DB_site->query_first("SELECT COUNT(*) AS total FROM user WHERE $condition AND adminemail=1");
with this:
Code:
	$counter = $DB_site->query_first("SELECT COUNT(*) AS total FROM user,userfield WHERE user.userid=userfield.userid AND $condition AND adminemail=1");
Also replace this:
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");
with this:
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");
Now, add this:
Code:
	    makehiddencode("homepage",$homepage);
after this:
Code:
	    makehiddencode("location",$location);
Also add this:
Code:
  makeinputcode("and location contains","location");
after this:
[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");
with this:
Code:
  $users=$DB_site->query("SELECT email FROM user,userfield WHERE user.userid=userfield.userid AND $condition AND adminemail=1");
That's it I think.
Reply With Quote
  #6  
Old 12-25-2001, 05:43 AM
mvigod mvigod is offline
 
Join Date: Dec 2001
Location: Jersey
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #7  
Old 01-22-2002, 10:49 PM
mvigod mvigod is offline
 
Join Date: Dec 2001
Location: Jersey
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 01-18-2008, 07:27 PM
scrapster scrapster is offline
 
Join Date: Mar 2005
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #9  
Old 01-24-2008, 04:05 PM
scrapster scrapster is offline
 
Join Date: Mar 2005
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

pretty please??
Reply With Quote
  #10  
Old 01-25-2008, 06:28 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:55 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07940 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (15)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete