Support » Plugin: BP Profile Search » Exclude one profile field

  • Hi Andrea,

    My apologies if this has been asked already, but I could not find it.

    I’m using the “Any profile field” on my search page, but I want to exclude just one specific user profile field from the search. Is there an easy way to accomplish this?

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

    (@dontdream)

    Hi djnz0813,

    You can 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_any')
    	{
    		$sql['where']['field_id'] = 'field_id NOT IN (3, 9, 25)';
    	}
    	return $sql;
    }

    Replace (3, 9, 25) with the list of field IDs that you want to exclude, or with (27) if you want to exclude a single field with ID 27.

    Thread Starter djnz0813

    (@djnz0813)

    Thank you! That worked perfectly.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Great! You’re welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.