Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi again,

    The solution is to put both fields in your search form, the Individual/Company field and the Name field. Users will specify the Name, and whether they wish to search the Individuals or the Companies.

    Thread Starter aldebaranmirko

    (@aldebaranmirko)

    There are many fields and are different for one and for the other.
    if I make a one module with all we would not understand anything, that’s why I made two separate

    Plugin Author Andrea Tarantini

    (@dontdream)

    You can insert hidden fields in a search form, adding this code in wp-content/plugins/bp-custom.php:

    add_filter ('bps_escaped_request_data', 'add_hidden_field');
    function add_hidden_field ($form)
    {
    	if ($form->id == 222)  // put the 1st form ID here
    	{
    		$field = new stdClass;
    		$field->id = 333;  // put the field ID here
    		$field->code = 'field_'. $field->id;
    		$field->value = 'Individual';  // put the field value here
    		$field->display = 'hidden';
    
    		$form->fields[] = $field;
    	}
    	else if ($form->id == 444)  // put the 2nd form ID here
    	{
    		$field = new stdClass;
    		$field->id = 333;  // put the field ID here
    		$field->code = 'field_'. $field->id;
    		$field->value = 'Company';  // put the field value here
    		$field->display = 'hidden';
    
    		$form->fields[] = $field;
    	}
    
    	return $form;
    }

    Add the Individual hidden field value to your first form, and the Company hidden value to your second form.

    Thread Starter aldebaranmirko

    (@aldebaranmirko)

    Perfect!

    Thank you very much !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘more search forms conditioned by a field’ is closed to new replies.