Locations Plugin

The Locations Plugin allows you to associate geocoded locations with topics, and list topics with locations on a map. Additionally it allows users to record their position (voluntarily) and this can show up on a map of Users in the Users directory.

:desktop_computer: Get the code

:page_facing_up: Read the documentation

:bug: Report a bug

Documentation Links

Administration Settings
Locations in Topics
Locations in Categories

98 Likes

I am very new with this technology. I have installed the plugin (I see the Map command in the hamburger menu and I have a location field in my User profile page (with working georeference with nominatim) BUT


I don’t see “Add location” button in the editor.

This is my configuration:

And this is the editor window:

Finally, this is the way I have installed the plugin:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-math.git
          - git clone https://github.com/paviliondev/discourse-events.git
          - git clone https://github.com/paviliondev/discourse-locations.git
          - git clone https://github.com/davidtaylorhq/discourse-whos-online.git
          - git clone https://github.com/discourse/twitter-profile-link.git
          - git clone https://github.com/discourse/discourse-tooltips.git

I have tried with locale= en with the same results.

2 Likes

Well, well, correction: the plugin works as expected in the User Profile.

According to the map, I am a dead person since the map indicates a point in the middle of the largest Montreal graveyard:

6 Likes

It has to be enabled for each of the categories that you wish to use it also.

5 Likes

Thank you! It has worked.

By the way, the check mark was “on” by default BUT!! you have to show the setup panel, uncheck and recheck to have the feature actually works.

4 Likes

Glad you got it working. It’s been a while since I used the plugin so it was kinda my best guess.

2 Likes

@angus I’ve noticed this issue recently when people don’t have a location entered on their profile:

Screen Shot 2020-04-21 at 21.18.40

Screen Shot 2020-04-21 at 21.18.05

It’s not occurring on every user though, can’t quite work out the pattern to it.

Maybe those who have deleted a location on their profile? Or maybe it’s and empty string eg “”, rather than NULL? :thinking:

1 Like

It looks like the recent update removed the location from the user card altogether.

User card:

User profile:

3 Likes

This is very likely caused by this change in core:

5 Likes

@omarfilip @david Thanks for the insight :+1:t2:

@angus is this something you’ll be able to modify?

3 Likes

@david @Richie Thanks, this plugin has been updated to support the change.

https://github.com/paviliondev/discourse-locations/commit/5c762ccc1f34d190fafec49498e95a395c73c2bb

Just a heads up that this plugin will soon be moving to the same update schedule as the rest of Pavilion’s main plugins. This means that it will be brought in line with the latest Discourse core in the first week of every month. Details to follow specific to this plugin, but see further here:

5 Likes

Thanks for the quick fix, Angus.

3 Likes

Hi @angus confirmed the locations are now displaying on the user card but we’re still seeing the issue whereby some users have a map pin and map icon showing even if they don’t have a location entered:

image

And on their full profile page:

2 Likes

I cannot start the Discourse app because of the locations plugin currently. Attaching log below, it works if I comment out locations in app.yml. Can someone prioritize this and fix it?

Also, is there a way to only upgrade to tests-passed version of the plugin (if there is such a thing), like how the main discourse app does? So that we do not run into such issues in future.

Log
5: from /var/www/discourse/plugins/discourse-layouts/plugin.rb:49:in `block in activate!'
4: from /var/www/discourse/lib/discourse_event.rb:13:in `trigger'
3: from /usr/local/lib/ruby/2.6.0/set.rb:338:in `each'
2: from /usr/local/lib/ruby/2.6.0/set.rb:338:in `each_key'
1: from /var/www/discourse/lib/discourse_event.rb:14:in `block in trigger'
/var/www/discourse/plugins/discourse-locations/plugin.rb:234:in `block in activate!': uninitialized constant DiscourseLayouts::WidgetHelper
Did you mean?  DiscourseLayouts::WidgetSerializer (NameError)

** INCOMPATIBLE PLUGIN **

You are unable to build Discourse due to errors in the plugin at
/var/www/discourse/plugins/discourse-locations

Please try removing this plugin and rebuilding again!
I, [2020-04-25T20:32:06.399307 #1]  INFO -- : gem install icalendar -v 2.4.1 -i /var/www/discourse/plugins/discourse-events/gems/2.6.5 --no-document --ignore-dependencies --no-user-install
HEADS UP! iCalendar 2.0 is not backwards-compatible with 1.x. Please see the README for the new syntax

HEADS UP! icalendar 2.2.0 switches to non-strict parsing as default. Please see the README if you
rely on strict parsing for information on how to enable it.

ActiveSupport is required for TimeWithZone support, but not required for general use.
Successfully installed icalendar-2.4.1
1 gem installed
gem install geocoder -v 1.4.4 -i /var/www/discourse/plugins/discourse-locations/gems/2.6.5 --no-document --ignore-dependencies --no-user-install
Successfully installed geocoder-1.4.4
1 gem installed

I, [2020-04-25T20:32:06.400580 #1]  INFO -- : Terminating async processes
I, [2020-04-25T20:32:06.400773 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 50
I, [2020-04-25T20:32:06.400979 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 167
167:signal-handler (1587846726) Received SIGTERM scheduling shutdown...
2020-04-25 20:32:06.401 UTC [50] LOG:  received fast shutdown request
2020-04-25 20:32:06.403 UTC [50] LOG:  aborting any active transactions
2020-04-25 20:32:06.406 UTC [50] LOG:  worker process: logical replication launcher (PID 59) exited with exit code 1
167:M 25 Apr 2020 20:32:06.406 # User requested shutdown...
167:M 25 Apr 2020 20:32:06.406 * Saving the final RDB snapshot before exiting.
2020-04-25 20:32:06.409 UTC [54] LOG:  shutting down
2020-04-25 20:32:06.439 UTC [50] LOG:  database system is shut down
167:M 25 Apr 2020 20:32:06.502 * DB saved on disk
167:M 25 Apr 2020 20:32:06.502 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 13098 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
b5a02d7f9df6b6a9dc160e269de30eef49bb0aeaf5dcb1b712bab5e6edad4030
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
root@discuss:/var/discourse#
3 Likes

@k4rtik Thanks for your report, and sorry you’ve been impacted. Your issue arose because:

  1. The layouts plugin was updated 2 days ago.
  2. The locations plugin was supporting the existing version of the layouts plugin.
  3. You use both plugins.
  4. You updated your Discourse in between the initial update of the layouts plugin and support being added to the locations plugin.

I’ve updated the locations plugin to support the new layouts plugin version: https://github.com/paviliondev/discourse-locations/commit/52aec30461f8439c6658fdc401127cb52881ab49. When you update now with both plugins installed, it will work. @Richie This will fix your issue: https://github.com/paviliondev/discourse-locations/commit/51850630187c43df8e2c8186a2943e20eeaadda2

Having a tests-passed branch in the plugin would unforatunately not help too much in this particuar situation, or a not-insignificant portion of other plugin incompatibility situations. People update at many different frequencies and have many different combinations of customisations.

That said, we’re starting to make some steps to address this problem. We’re moving to a schedule of ensuring Pavilion’s primary open source plugins (this plugin, Events, Topic List Previews etc) are up to date with Discourse every 24 hours in the first 5 days of every month, starting May 1 to 5.

This gives you a safe window to update all the plugins on try.thepavilion.io along with Discourse itself with greater certainty that:

  1. You won’t experience conflicts between the plugin and Discourse, and if you do they will be addressed within less than 24 hrs.

  2. You won’t experience any issues due to changes in the plugin itself. Any potentially breaking changes to the plugin itself will happen outside this window.

This applies to all the plugins listed here:

This list may be expanded over time. See further: https://try.thepavilion.io.

If you have any questions about this, feel free to PM me, or contact us over at thepavilion.io.

8 Likes

Thanks, yeah, I was trying to figure out why my custom layout was not showing up either with the last update. It still doesn’t seem to appear but I see on Pavilion that you are in the process to release updated doc for the changes in the plugin so I will wait a while.

2 Likes

@angus confirmed - issue resolved :clap:t2:

Thanks again for your continued support of this plugin :smiley:

4 Likes

Hi @angus I saw a notification to say the first post in this thread was edited.

Looks like the location of the repo has moved.

Should we all update our discourse settings to the new location or will the existing / old location still be updated?

Do we need to rebuild anything after changing the plugin source location?

3 Likes

Hey @Richie, you can continue using the old url of https://github.com/angusmcleod/discourse-locations. You can wait to update it when you naturally get a chance, i.e. you have to rebuild your site for some other reason.

The plugin was transferred from my personal github to Pavilion’s some time ago. When a repository is transferred, Github automatically redirects all links to the old location to the new one.

The first post will be changing a bit more in the coming weeks. I’m going to write some documentation for this over on thepavilion.io and a shorter description here on meta.

4 Likes

Excellent, I didn’t know that :+1:t2:

Thanks once again for the support!

3 Likes