Support » Plugin: BP Profile Search » Default search

  • It would be possible to set a search field ( for example City ) based on one of the user’s xprofile fields ( City where he lives )
    So that the user when he visits the directory already receives the list of members of her City (but has the possibility to modify the search and make a new one)

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

    (@dontdream)

    Hello @dragon38,

    Sorry I missed your post! Please let me know if you still need help with this.

    yes i need
    thx

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hello dragon38,

    Sorry for the late reply!

    If you add this code to your bp-custom.php file, your Members directory will only list the users living in the same City of the current logged-in user, unless he/she is searching for a different City.

    Replace 567 with the actual ID of your City field.

    add_filter ('bps_hidden_filters', 'directory_filters');
    function directory_filters ($filters)
    {
    	$user = bp_loggedin_user_id ();
    	if (empty ($user))  return $filters;
    
    	$filters['bps_directory'] = bps_current_page ();
    	$filters['field_567'] = empty ($_REQUEST['field_567'])? addslashes (xprofile_get_field_data (567, $user)): $_REQUEST['field_567'];
    
    	return $filters;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default search’ is closed to new replies.