Forum Academy Marketplace Showcase Pricing Features

User Location Sharing

Basically, I have two kinds of users. Regular Users and Vendors. I need the Vendors to be able to turn their location on and off and have that data passed to google maps to direct Users to the Vendor. I have Google geolocation and Maps plugins’ installed. I’m just unsure of what I need to do on the backend. Any assistance would be fantastic.

Hey there,

as far as I understand your problem is just getting the vendors information and showing it on an map right?

So a basic solution I think would be to have an input area with Name, Address (you can add as many as you like, lets use this 2 as example) and a submit button.
On submit you would create a new "thing"called Vendors with 2 fields, Name and Location. Assign them to your input boxes.

Also you need a map, create a map and set the Numbers of markers to “List”, type of markers to “Vendors”, data source should be “search for Vendors”(without restriction) and address field to “Location”.

I think that should work, you could also play with marker caption to display more information.

Let me know if this works and solves your problem or if you’re getting any error out of it.

Thank you for responding, but i don’t want the vendor to have to type anything. I want the vendor to flip a toggle switch in the app which activates or deactivates location services. When the user navigates to the Vendors profile they’ll be able to click a button that says “Get Directions” clicking that button will grab the Vendor’s location and pass the information to Google Maps to help the User with navigation.

But in hindsight, if that solution would be too difficult to implement, maybe it’s best for me to do it the way you’ve outlined.

I don’t think it will possible to turn “Location Services” off and on at a browser level.

However you could simulate this by having two buttons.

“Set Location” would set the vendors current location and store it using “Current Location”. You could show a little map next to it so they know they are doing it correctly.

“Clear Location” would zeroise their location, but you would need to make sure your “User” side handled this, otherwise it is likely to show them Antarctica.

Bear in mind that if the user doesn’t allow the webpage location services access (And I think Google now force you to have a https site to get location) then there is very little you can do, apart from tell them to turn it on again :slight_smile:

This method is likely to be more accurate than adding an address, however since most vendors will have a premise … I would say you are going to have an easier time just using the address they have input. That way you are not relying the browser to tell you where they are.

1 Like

I’ve created a simple public app. Maybe that’s what you’re looking for.

There’s a vendor’s page with a text field showing it’s unique ID. Since there’s no login I’m showing the ID to differentiate the users, but in your app you can use name/email.
There’s also to button, turn on and off, that will show there position in the map.
You can see the workflow but it basicly create a new thing and assign it to the user. Turno off deletes the current user vendor (I called the field in user what_vendor).

I don’t know how to share an open app, here’s the link IDk if will work, if not tell me what to do:

This topic was automatically closed after 70 days. New replies are no longer allowed.