View Single Post
  #4  
Old 08-21-2004, 03:07 AM
oldford's Avatar
oldford oldford is offline
 
Join Date: Feb 2003
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just did this tonight. I'm sure it's not the cleanest way to do things, but it works for me. Screenshot attached.

All I did was copy the advanced search code for "search by state" and put it at the top of my Member List so people could search it more easily.

1. Create a new "User Profile Field" named State. Make it a "single selection menu" field and add in all your states. (See a list of US states at the bottom of this post to copy and paste) Be sure to also set "Field Searchable on Members List" to "yes".

2. Note what field # your new State field is. (ie. mine was field10)

3. Edit your "memberlist" template.

Below this code:
Code:
<body>
$header
$navbar
Add this: (but be sure to change the field # to your correct #. See item 2 above)

Code:
<form action="memberlist.php" method="post">
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="getall" />
Search Members by State: <select name="field10" id="csel_field10"><option value="0" selected="selected"></option>
<option value="1" >AL</option><option value="2" >AK</option><option value="3" >AZ</option><option value="4" >AR</option><option value="5" >CA</option><option value="6" >CO</option><option value="7" >CT</option><option value="8" >DE</option><option value="9" >DC</option><option value="10" >FL</option><option value="11" >GA</option><option value="12" >HI</option><option value="13" >ID</option><option value="14" >IL</option><option value="15" >IN</option><option value="16" >IA</option><option value="17" >KS</option><option value="18" >KY</option><option value="19" >LA</option><option value="20" >ME</option><option value="21" >MD</option><option value="22" >MA</option><option value="23" >MI</option><option value="24" >MN</option><option value="25" >MS</option><option value="26" >MO</option><option value="27" >MT</option><option value="28" >NE</option><option value="29" >NV</option><option value="30" >NH</option><option value="31" >NJ</option><option value="32" >NM</option><option value="33" >NY</option><option value="34" >NC</option><option value="35" >ND</option><option value="36" >OH</option><option value="37" >OK</option><option value="38" >OR</option><option value="39" >PA</option><option value="40" >RI</option><option value="41" >SC</option><option value="42" >SD</option><option value="43" >TN</option><option value="44" >TX</option><option value="45" >UT</option><option value="46" >VT</option><option value="47" >VA</option><option value="48" >WA</option><option value="49" >WV</option><option value="50" >WI</option><option value="51" >WY</option></select>  <input type="submit" class="button" value="Search" accesskey="s" />
</form>
The above search code willl only work if you use the same exact list of states I did. If you modify it you'll need to modify the code accordingly. Or just view the source code of your "advanced search" page and steal the Search by State bit.


Here's is a list of US states to copy and paste.
Code:
AL
AK
AZ
AR
CA
CO
CT
DE
DC
FL
GA
HI
ID
IL
IN
IA
KS
KY
LA
ME
MD
MA
MI
MN
MS
MO
MT
NE
NV
NH
NJ
NM
NY
NC
ND
OH
OK
OR
PA
RI
SC
SD
TN
TX
UT
VT
VA
WA
WV
WI
WY
Attached Images
File Type: gif searchbystate.gif (9.1 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01118 seconds
  • Memory Usage 1,802KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete