• Resolved emptypack

    (@emptypack)


    Hello Andrea, I wanted to ask, is there a way to eliminate fields in search when there isn’t any member in that field. For example, a search filter will show all possible selection:
    Search by age

      12-20;
      21-40;
      41-60;
      62+

    But I want to achieve, that it shows only those selection, which is not empty and have a member in it.

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

    (@dontdream)

    Hi emptypack,

    That’s an interesting feature, but unfortunately it’s not yet available in BP Profile Search. Sorry!

    Hello Andrea,

    I’m interested too, is there a way (by modifying functions.php or core file) to eliminate those results from selection, which one doesn’t have any member in it. For example, members can select which language they speak, so if there is a selection from 40 languages and members just select 5 of them, all 40lang are displayed in the search filter and it’s bad with UX because visitors keep selecting language without a member.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hello netreneris,

    If you add this code to your bp-custom.php or functions.php, you can select which options to display in the search field:

    add_action ('bps_field_before_search_form', 'set_options');
    function set_options ($f)
    {
    	if ($f->code != 'field_123')  return;
    
    	$f->options = array
    	(
    		'English' => 'English',
    		'Spanish' => 'Spanish',
    		'French' => 'French',
    	);
    }

    Replace 123 with the actual field ID of your ‘Languages’ field, and change the language list as needed.

    Remember to update the language list when your members add a new language to their profiles.

    Thanks, it’s working!

    Plugin Author Andrea Tarantini

    (@dontdream)

    Great, you are welcome!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Eliminate’ is closed to new replies.