Locations Plugin

(Tobias Eigen) #183

Pretty cool! Thanks for your good work on this. I tested it out on the sandbox and it works well - I like the way you can start typing in your location and it autocompletes. Slick!

Some immediate thoughts:

  • some sort of nudge to complete the location field would be nice, to backfill existing users - not sure how to handle it. maybe a popup when users log in?
  • maybe also a rake command to backfill using what users put in their location field? on our site, we use SSO to fill this with country data, which could be used to place members on a map.
  • it would be more fun to explore the map if clicking on the user opened the user card instead of clicking through to the user profile.
  • it’s not immediately clear that you can just type in a location in the “Map Location” field on the prefs and what the field is for. Some helper text would help, e.g. “type in your city, zip/postal code or country and you will be included on the user map!”
  • maybe this is obvious, but consider showing mouseover helper text when the number of members in a region is shown in a green circle, e.g. “there are 2 users in this region. select to zoom in to show them”


Agree with Tobias on this, user card would be nicer, so you don’t have to close the map or go back and forth.

Yeah, I agree with this. But I love the efficiency of the search box. Also could it offer a map pinning option too?

However you bake it, it would be good to have some way of getting a list of all users within an arbitrary region.

Might even be nice to be able to somehow PM them all easily in one go?

Or invite users within a specific region to a new Topic?

And not just a region based on my current location … e.g. you might be prepared to fly to New York State and want to invite all users in that region to a meet?.. what’s the quickest and easiest way to achieve that?

The user location aspect of this plugin has lots of promise - great work so far, thank you!

Event organizing in Discourse

You are right. I updated to the latest and it looks great. Thanks.

(Ruth Cheesley) #186

Love the new user location features, a couple of points:

  1. As others have said, the wording is confusing (I thought initially I had to put lat/long in the box, didn’t realise I could just type the address!

  2. It is pretty important that access to the user map can be restricted. I’d expect many people to be asking for this. Both on a global basis (who can see the user map), group basis (show only these groups on the map) and on an individual basis (don’t show me on the map) where individual setting has precedence.

  3. It would be really helpful to be able to filter the user list down by people who are geographically nearby (if they have consented to feature on the map)


Really? Can’t we just advise users to enter an approximate location if they wish for their absolute location to remain private. You can also simply … not enter your location if you wish to keep it hidden :slight_smile:

What’s the point of the feature if you are going to hide it?

Having said that restricting the view to logged in users above a set trust level makes sense and you could also restrict those shown on the map by trust level so it would only show ‘regulars’ - can imagine the map getting noisy if you show everyone that has an account (and could impact performance?)

(Ruth Cheesley) #188

Say you have a forum where people want to be able to connect with each other but they don’t want people outside the forum to be able to see their location. I certainly would foresee there being issues with this feature not being restricted by trust level or at a minimum having an option to make it public, or require login to view.

At the user level, perhaps they have a reason for not wanting to even share their approximate location (many reasons - relocated abuse survivors, for example).

In terms of setting what users could be displayed, this could be an up-sell for higher trust levels, that they are featured on a geo map and therefore could have more people reaching out (for example I am thinking of a forum where professional services might be available from members. If they reach higher trust levels, they show on the map and hence might get more opportunities coming their way).


So if you don’t want to share even your approximate location, why even enter it at all? For the benefit of the moderators? Blimey, that’s an extreme example!

(Tobias Eigen) #190

Great suggestions! Thank you.

I agree that an admin setting for this would be reasonable to hope for. Not every site will want to share the map with everyone. Also, “unlocking the map” might be a handy incentive to reach a higher trust level.

This already happens if you zoom in on the map to a specific location. Or were you thinking of a NEAR ME button to zoom in straightaway to show your own pin and those near you?

A button to ADD MY LOCATION might not be a bad idea to have on the map itself for those users who have not yet set their location, and UPDATE MY LOCATION if they have set their location.

You’re triggering another thought too which is that it would be handy to be able to use the same filters available on /users to filter the users displayed on the map. Right now the user list is more of a leaderboard and displays all users, and can only be filtered by activity date range or by specific username, but that might change someday. In particular, there have been requests to also allow filtering by group which my community would love. We make very active use of groups.

(Angus McLeod) #191

We considered using the existing data in the ‘Location’ string field, but decided against it, partly for technical reasons, partly because locations can be ambiguous (so results could be unexpected), and partly because when the user gave their location originally it wasn’t the the context of geocoding that location (i.e. ‘surprising’ for the user / possible privacy issues).

Yes, the featured needs to be highlighted in some way. Could use a link in a banner perhaps.

I agree.

Also agree.

Perhaps the map could have clickable tiles for regions. On clicking a region, a popover appears with a list of users in that region.

Yes, I agree that settings along these lines are needed.


So to summarise

  1. The location input needs some helper text and / or a placeholder to explain the feature.

  2. Clicking on a pin should open a user card. This may also apply to topics on a map.

  3. The map needs view permission settings, perhaps based on trust levels.

  4. The map should be searchable. This also applies to topics on a map.

  5. Relatedly, the map should be filterable in the same way the Directory is filterable, and / or by proximity.

  6. Regions of the map should perhaps be clickable to show lists of an item within a region. This also applies to topics on a map.

@Sudaraka Great feedback eh :slight_smile: How do you feel about these next steps? Anything I missed?


btw, GDPR may cover this data. I think we may need a note somewhere that by entering the data waives the right of privacy of your entered location if it is to be displayed on a forum wide map? And perhaps a note saying that removing your location will remove you from the map?

(Tobias Eigen) #193

Another fun idea - display user (and/or group?) avatar flair on the map instead of pins? That way you could immediately differentiate on the map between different types of users.

(Sudaraka Jayathilaka) #194

I agree with you @angus. These features enhance the usability of the plugin.

(Sea) #195

I want to mention that in my case is in other language than English and the best suitable and practical map provider service is Google. Please please consider this because all map create unequal and improve unequally. If the outcome doesn’t look right and proper, but when someone work on the topic has the right geo location in other language correctly. This will greatly effect how they approach the topic with the right language and understanding of street name and city name. This plugin will be universally accept.

Thank you,
Best plugin ever.


A post was split to a new topic: Locations plugin modifications

(Angus McLeod) #197

If you’re having a specific problem with the translations in the data from the services this plugin supports you can raise it here. All of the services this plugin supports are internationalised.

From my understanding of the Google Maps Terms of Service there are two problems with using Google Maps:

  1. Google Maps content can only be displayed on a Google Map. Section 10.4(d) of the terms provides:

    No use of Content without a Google map. Unless the Maps APIs Documentation expressly permits you to do so, you will not use the Content in a Maps API Implementation without a corresponding Google map. For example, you may display Street View imagery without a corresponding Google map because the Maps APIs Documentation expressly permits this use.

    This means that if you use Google Maps to geocode addresses you have to display the results on a Google Map layer. However Google Map layers don’t work with Leaflet.js (the mapping library this plugin uses). This is solvable however it would require re-writing a fair portion of the plugin to support a different map display using the Google Maps API entirely.

  2. You can’t store Google Maps content. Section 10.5 of the terms includes:

    No caching or storage. You will not pre-fetch, cache, index, or store any Content to be used outside the Service, except that you may store limited amounts of Content solely for the purpose of improving the performance of your Maps API Implementation due to network latency (and not for the purpose of preventing Google from accurately tracking usage), and only if such storage:

    1. is temporary (and in no event more than 30 calendar days);
    2. is secure;
    3. does not manipulate or aggregate any part of the Content or Service; and
    4. does not modify attribution in any way

    This means that you can’t store the latitude and longitude coordinates derived from geocoding an address entered by a user. Every address would have to be periodically re-coded, or coded from the user entry on each render (you can’t store the formatted google address either).


I reported a bug over here and it applies for this plugin as well.

(Angus McLeod) #199

Thanks again :slight_smile:

(Ryan Erwin) #200

@Francois_Douville We’ve completed implementation of the site wide “Map” link from the hamburger menu under @angus’s mentor program (Learn how to build Discourse plugins by helping me).

New “/map” related admin settings


Map in the top menu

Map in the hamburger menu


Site wide map in action

Activate it…

This is live in the current github code… so just ./launcher rebuild... or git pull or whatever your environment requires to get the latest plugin code.


OK, I’ve started to explore this plug-in in my dev server but have come across an issue:

  • http://my-dev-ip/admin/users/list/active has 3 users including my admin account BUT
  • http://my-dev-ip/u/user-map shows no users despite Map Location being non-blank for the admin account

I checked the code in users_map.rb and ran the following in Data Explorer, comes back non-blank and shows my admin account:

SELECT user_id FROM user_custom_fields WHERE name = 'geo_location'

Any ideas why /u/user-map is not showing anything?

Edit, yeah, I can see the data is coming into the browser when debugging in the map widget … but it’s not showing … it’s something else … any ideas @Sudaraka?

(Craig Davison) #202

How can we display user location on profile? I’ve noticed @angus has ‘New York’ displayed on his profile on the test forum but I wonder how this can be enabled.