Announcement

Collapse
No announcement yet.

How To Search Memberlist Profile Fields Via A URL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Search Memberlist Profile Fields Via A URL

    This is the search form in question:

    http://www.yoursite.com/forum/memberlist.php?do=search

    If the profile field is present on this search page, then you can search for it with a URL. You can submit a search to this form by loading a URL like this:

    http://www.yoursite.com/forum/memberlist.php?do=getall<field list>

    Where <field list> is a list of search criteria in the format specified below.

    Building A <field list>
    For each search option you need to add this onto the URL:

    &fieldname=value

    There are six different kinds of profile fields you can search for:

    Single-Line Text Box:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<input type="text" class="bginput" name="fieldX" value="" size="#" maxlength="#" />
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the text value in the URL. For example, if the field identifier is field2 and you want to search for the word vbulletin, then the <field list> would look like this:

    &field2=vbulletin

    Multiple-Line Text Box:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<input type="text" class="bginput" name="fieldX" value="" size="#" maxlength="#" />
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the text value in the URL. For example, if the field identifier is field2 and you want to search for the word vbulletin, then the <field list> would look like this:

    &field2=vbulletin

    Single-Selection Radio Buttons:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<label for="rb_cpf_fieldX_1"><input type="radio" name="userfield[fieldX]" value="1" id="rb_cpf_fieldX_1"  />OPTION 1</label> &nbsp;
    	<label for="rb_cpf_fieldX_2"><input type="radio" name="userfield[fieldX]" value="2" id="rb_cpf_fieldX_2"  />OPTION 2</label> &nbsp;
    	<label for="rb_cpf_fieldX_3"><input type="radio" name="userfield[fieldX]" value="3" id="rb_cpf_fieldX_3"  />OPTION 3</label> &nbsp;
    	<label for="rb_cpf_fieldX_4"><input type="radio" name="userfield[fieldX]" value="4" id="rb_cpf_fieldX_4"  />OPTION 4</label> &nbsp;
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the corresponding option number in the URL. For example, if the field identifier is field2 and you want to search for the third option (number 3), then the <field list> would look like this:

    &field2=3

    Single-Selection Menu:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<select name="fieldX" id="csel_fieldX">
    		<option value="0" selected="selected"></option>
    		<option value="1" >OPTION 1</option>
    		<option value="2" >OPTION 2</option>
    		<option value="3" >OPTION 3</option>
    		<option value="4" >OPTION 4</option>
    	</select>
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the corresponding option number in the URL. For example, if the field identifier is field2 and you want to search for the third option (number 3), then the <field list> would look like this:

    &field2=3

    Multiple-Selection Menu:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<select name="fieldX[]" id="csel_fieldX" size="0" multiple="multiple">
    		<option value="1" >OPTION 1</option>
    		<option value="2" >OPTION 2</option>
    		<option value="3" >OPTION 3</option>
    		<option value="4" >OPTION 4</option>
    	</select>
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the corresponding option number in the URL. For example, if the field identifier is field2 and you want to search for the third option (number 3), then the <field list> would look like this:

    &field2[]=3

    You can chain this together multiple times to search for multiple options since this is a multiple-selection menu. For example, to search for users with option 3 and 4 selected, use this:

    &field2[]=3&field2[]=4

    Multiple-Selection Checkbox:
    These profile fields look like this in the source code:

    Code:
    <div class="fieldset">
    	NAME:<br />
    	<label for="cb_cpf_fieldX_1"><input type="checkbox" name="userfield[fieldX][]" value="1" id="cb_cpf_fieldX_1"  />OPTION 1</label> &nbsp;
    	<label for="cb_cpf_fieldX_2"><input type="checkbox" name="userfield[fieldX][]" value="2" id="cb_cpf_fieldX_2"  />OPTION 2</label> &nbsp;
    	<label for="cb_cpf_fieldX_3"><input type="checkbox" name="userfield[fieldX][]" value="3" id="cb_cpf_fieldX_3"  />OPTION 3</label> &nbsp;
    	<label for="cb_cpf_fieldX_4"><input type="checkbox" name="userfield[fieldX][]" value="4" id="cb_cpf_fieldX_4"  />OPTION 4</label> &nbsp;
    </div>
    Where fieldX is the field identifier of the profile field as shown in your:

    Admin CP -> User Profile Fields -> User Profile Field Manager

    You need to specify the corresponding option number in the URL. For example, if the field identifier is field2 and you want to search for the third option (number 3), then the <field list> would look like this:

    &field2[]=3

    You can chain this together multiple times to search for multiple options since this is a multiple-selection menu. For example, to search for users with option 3 and 4 selected, use this:

    &field2[]=3&field2[]=4

    Searching Multiple Profile Fields At Once
    Just take the examples above and string them together. For example, this URL will search for members matching all of 3 different profile fields:

    http://www.yoursite.com/forum/memberlist.php?do=getall&field2=vbulletin&field6=3&field5[]=4
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X