Locations Plugin

(Rich) #243

And an issue :blush:

Some of our users had previously entered a “Location” in to their profile, before we installed your plugin.

That “old” location is still visible on the user card, and the user now has no way of editing or removing it as the option is no longer available in their Preferences.

Eg, here’s mine:

Yet after moving house, my map location is some 250 miles away:

We should hide their old “Location” from the user card completely.

And / or the user card should now show their new “Map Location” instead?

(Angus McLeod) #244

The issue is not the button per se. It’s that your addresses aren’t getting geocoded, as geocoding was disabled when coordinates were enabled. A non-geocoded address can’t be displayed on a map.

I’ve made the update I mentioned earlier. You can now enable coordinates and still geocode addresses separately. I’ve also given them a visual distinction in the UI.

Sure, I’ll add it on the weekend.

Good point. @Sudaraka are you able to take this one?

(Rich) #245

Hi @angus this is great!!

It provides the best of both worlds :+1:

Can you remove the requirement to populate each field on the form before enabling the “Find Address” button?

Here in the UK, just a partial postcode is all that’s required to start getting results. I tried putting a blank space in each form section and sure enough, it still returned addresses - which is fantastic!

So if we can do away with the requirement and make the Find Address button clickable at all times, it would be simply stunning :smiley:

Thanks again for this wonderful plugin mate :blush:

(Rich) #246

If you could fix that user card bug @Sudaraka (or replace the user card location with the Map Location instead? although that might be a bit too long?) that would be equally as great too :smiley:

(Sudaraka Jayathilaka) #247

Hey @Richie and @angus.

I will work on the one above and move into the one below

(Angus McLeod) #248

@Richie I’ve made an update that should address your use case :slight_smile:

@Sudaraka Great! We can chat more about it via pm.

(Rich) #249

Great news @Sudaraka - thank you!

Update installed here, it works beautifully!!!

Amazing work @angus :bowing_man:

Do you have a paypal donation address where we can send a few :beer: to?

And if you’re able to add a map icon (fa-map-o or similar?) that’d be cool too :smiley:

Thanks again for your hard work guys, we love it!

(Rich) #250

Sorry, back again with another issue to report :cry:

One of our users has set ‘something’ in their location which has completely broken the entire User Map page :sob:

I have no idea who, and no idea what they’ve entered, but the User Map no longer displays any pins and throws some console errors:

Any ideas how I could find out which member it was @angus , so I can manually remove/edit them to fix the User Map page? :thinking:

(Angus McLeod) #251

Sorry about that!

I’ve just made two updates that should fix the map and also prevent a user from entering an invalid location in the future.

(Rich) #252

You can never tell what end users will do, eh? :smiley:

Thanks for the super-quick fix @angus :+1:

@Sudaraka any news on your new features mate?

(Keven Naphtali) #253

Hi there,

I’m getting an Internal Server error when trying to change user preferences. I do have the discourse-locations plugin installed with the latest discourse [v2.2.0.beta2 +107].

This is the error log I get:
NoMethodError (undefined method []' for nil:NilClass) /var/www/discourse/plugins/discourse-locations/lib/users_map.rb:30:inmodify_user_params’

Which leads me to believe it’s a locations plugin issue.

I enabled user locations, played with it, and then disabled it. Not sure if this caused the problems.

(Angus McLeod) #254

@keven Thanks for the report. That should be fixed now.

(Keven Naphtali) #255

Wow. Awesome. Love the plugin. Thank you!


Installing this plugin break my installation.

The page won’t load and just display blank. At the developer console I can see this:

It seems to be related to cloudflare rocket loader:

I disabled it, and will report back to see if the issue is fixed. However I’d like to keep that function enabled in cloudflare :stuck_out_tongue:

Edit: Disabling rocket loader makes it work.

A workaround may be to include a tag to exclude rocket loader optimization, How can I have Rocket Loader ignore specific JavaScripts? – Cloudflare Support. But i’d rather have them be be able to optimize too :slight_smile:

Also what happens if I use this plugin in a post, then uninstall it later?

(Angus McLeod) #257

Thanks for trying out the plugin!

Sorry, but I can’t add cdn ‘optimization’ feature specific support. I would have to figure out how Rocket Loader works, and work around what is a instance-specific problem.

The locations will still be saved in your database, but they will no longer appear.


You don’t have to figure out anything, you just have to include <script data-cfasync="false" src="/example.js"></script> in your scripts and rocket loader will ignore your scripts.

I can help you test if you want. For now I’m using a page rule that disables rocket loader only in that URL in my domain, but you only have 3 free so it’s good to avoid using it.

Thank you anyways! Loving the script.

(Rich) #259

Just a question this time @angus :blush:

When new users sign up, we present a custom user field to them:

Is there a way we can add the “Map Location” to this sign-up form too?

(Rich) #260

And sadly, I have a new bug to report :slightly_frowning_face:

Steps to replicate:

  1. Create a new topic, enter UK location and Post code of: SW19 3AR

  1. Pin appears on Show Map button correctly:

  1. Edit the post

  2. Click the address button (to edit the map pin location)

  3. Change the LAT to 51.42 and the LNG to -0.20

  4. Click Done and Save your edited post.

  5. Click the Show Map button. The map is still centered where the old pin location was, and no pin is visible:

  1. Zoom out six clicks or so in order to see the new pin location


Also, the address is not updated in thread and still shows the original address and postcode of SW19 3AZ when in reality the new location is miles away from there.

Let me know if you need any more details!

(Rich) #261

Another feature request :wink:

Can you make this text configurable in the admin control panel?


We have a lot of members who when adding a location to their profile just enter the town. Which means when viewing the members map, you might see 8 pins in Cardiff, 12 pins in Manchester, etc.

Well, that’s the problem actually, is that you don’t see all the pins, because they’re all on top of each other.

If that line of text were editable on the control panel we’d probably change it to say “Please use a suburb, not a town” or something along those lines :+1:

Any news @angus if the previous feature request is do-able? To allow people to enter a location at the point of creating a new account?

And @Sudaraka any news on that bug report from a few weeks ago?


How can I help translate the plugin?