Multiple location fields

Home Forums BP Profile Search Forum Multiple location fields

This topic contains 1 reply, has 2 voices, and was last updated by  andrea 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10427 Reply

    Michael Spencer

    Andrea,
    Is it possible to set up say 3 location fields in a user record, then have one location search that looks in each of these fields. Basically I want to set up a member directory and some members want to be able to list more than one location they work from.

    #10430 Reply

    andrea
    Keymaster

    Hi Michael,

    Let’s say you have 3 location fields, with IDs 10, 11, and 12.

    You can add to your search form the first field only (field 10), then add this code to your bp-custom.php file:

    add_filter ('bps_field_sql', 'change_query', 10, 2);
    function change_query ($sql, $f)
    {
    	if ($f->code == 'field_10' && $f->filter == 'distance')
    		$sql['where'][1] = 'field_id IN (10,11,12)';
    	return $sql;
    }

    This way when you search field 10, you’ll be searching fields 11 and 12 as well.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Multiple location fields
Your information: