BuddyDev

Search

Want to create location based search for members in buddypress

  • Participant
    Level: Initiated
    Posts: 1
    Vineeta Saxena on #4781

    I want to create a location based search in buddypress for members by just putting location like “Alabama” in the menu and when clicked, the search should come out as members from Alabama only. Can anyone help?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2447
    Ravi on #4784

    Hi Vineeta,

    Welcome to BuddyDev Forum. Please explain me bit more. Tell me what exactly you want.

    1. Will it be a simple text based search to find the members under a particular location. If Yes it can be done easily.
    2. Will it be a search based on location such as geo location to find out the member with in the certain range. If yes then it would be a strategical job and will take time.

    Please let me know. What exactly your requirement is?.

    Thank You
    Ravi

  • Participant
    Level: Initiated
    Posts: 1
    Vineeta Saxena on #4787

    Yes, I need to do both kinds of searc. Geo location based is also needed. How to do it?
    thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 21520
    Brajesh Singh on #4801

    Hi Vineeta,
    In that case please think about this:-
    1. How do you want to collect user location data?
    2. Do you want to store the location as lat/lang pair or as spatial data type. MySQL dos have support for basic gis functionality/spatial data types, so you should create a new table and store user/point combination there. The Point is spatial data type and you will be storing WKT here.

    3. If you have used the data type point, you may use spatial functions ST_DWithin/ST_Distance to accomplish your task.
    https://dev.mysql.com/doc/refman/5.6/en/spatial-relation-functions-object-shapes.html

    If you are not comfortable with GIS data, you may store the user location as latitude/longitude pair. This tutorial (It is old when mysql had no support for spatial data types), by Google should help

    https://developers.google.com/maps/articles/phpsqlsearch_v3

    All the best
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved