Autocomplete the location
-
Hi Andrea, excellent complement!
I’m looking for the form to auto-complete the form with xprofile? for example the xprofile ID 9 with the location in the form field without “search” directly for the result? is it possible?
thanks!!-
This topic was modified 6 years, 6 months ago by
jennifersanchez.
-
This topic was modified 6 years, 6 months ago by
-
Hi Jennifer,
At this time BP Profile Search doesn’t support that feature. Sorry!
Hi Andrea! Thanks for your answer!
I was thinking.. is it possible a hide filter like [bps_directory field_5=”field_30″] .
Field 30 is a xprofile of a user.I tried with the given code but I don’t know how to determine the distance
add_filter ('bps_hidden_filters', 'my_hidden_filters'); function my_hidden_filters ($filters) { $user_id = bp_loggedin_user_id (); if ($user_id != 0) { //place is the xprofile of the location a user $place= xprofile_get_field_data (46, $user_id); //field_247 is the location of users who should show that they are closer to 40 km from them $filters['field_247'] = $place; } return $filters; }Thanks!!
-
This reply was modified 6 years, 6 months ago by
jennifersanchez.
sorry the code im using is it
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 (); $location1 = xprofile_get_field_data (46, $user ); if (!empty ($location1)){ $filters['field_62'] = empty ($_REQUEST['field_62'])? addslashes ($location1): $_REQUEST['field_62']; return $filters; }}how i can do to determine the distance of 100Km?
Hi Jennifer,
Try this code:
add_filter ('bps_hidden_filters', 'directory_filters'); function directory_filters ($filters) { global $wpdb; $user = bp_loggedin_user_id (); if (empty ($user)) return $filters; $table_name = $wpdb->prefix. 'bds_locations'; $query = "SELECT * FROM $table_name WHERE user_id = $user AND field_id = 46;"; $value = $wpdb->get_row ($query); if (!empty ($value)) { $filters['field_62_distance']['distance'] = 100; $filters['field_62_distance']['units'] = 'km'; $filters['field_62_distance']['location'] = $value->location; $filters['field_62_distance']['lat'] = $value->lat; $filters['field_62_distance']['lng'] = $value->lng; } return $filters; }Awesome!! Thanks!
Hi Andrea, I’m looking for the compatible way that a user field has 5 places loaded and search it with the address of another.
example:User 1 field_5:
Paris France,
Buenos Aires, Argentina,
Madrid, SpainUser 2 field_6:
Madrid, SpainHow have you helped me, one location of a user with another I can find it, but is it possible with more? for example the user 2 find the user 1 because it have Spain?
Is it possible with repeater fields or should I do with a checkbox or text box with comma and a unique name field?
Thanks very much!-
This reply was modified 6 years, 6 months ago by
jennifersanchez.
Hi Andrea.
Im using a complement to add repeater fields of locations to the profiles.
im bring the group fields with $group_values, but it didnt work, can you guide me what im doing wrong please?how i can do for this code is in a directory (page) different than the above code?
add_filter ('bps_hidden_filters', 'directory_filters'); function directory_filters ($filters) { $group_values = wbbpp_get_group_values( $group_name = 'bprm_grp_edu'); $group_values = array(); $user_id = get_current_user_id(); $bprm_rs_data = array(); $bprm_rs_data = get_user_meta( $user_id, 'wbbpp_userdata', true ); global $wpdb; $user = bp_loggedin_user_id (); if (empty ($user)) return $filters; $table_name = $wpdb->prefix. 'bds_locations'; $query = "SELECT * FROM $table_name WHERE user_id = $user AND $bprm_rs_data[$group_name];"; $value = $wpdb->get_row ($query); if (!empty ($value)) { $filters['field_46_distance']['distance'] = 100; $filters['field_46_distance']['units'] = 'km'; $filters['field_46_distance']['location'] = $value->location; $filters['field_46_distance']['lat'] = $value->lat; $filters['field_46_distance']['lng'] = $value->lng; } return $filters; }reference: https://pastebin.com/JFSLG2mi
Thanks very much!!
-
This reply was modified 6 years, 6 months ago by
jennifersanchez.
Hello Jennifer,
If you are using ‘BuddyPress Profile Pro’, you could ask them if their fields are searchable by BP Profile Search (or you can try yourself to add those fields to a search form and confirm the search is working).
If the answer is no, there is no way to make those fields work as hidden filters.
-
This reply was modified 6 years, 6 months ago by
The topic ‘Autocomplete the location’ is closed to new replies.