Locations Plugin

Discourse changed their User List data retrieval, so we were forced to change the way we approached this. You may have to live with the new performance level for the time being. I’d be interested to hear of other accounts though.


I just upgraded today and things look good.

Please upgrade before Monday if you intend to do so this month as I will not be supporting breaking changes until next month.


We’ll sit tight until next month, thanks again :slight_smile:

1 Like

Me too…

@JimPas (or anyone else for that matter!) are you having a problem with the delay before the map loads?

@merefield out of interest, is there a way to link directly to the users map? Without needing to go through the users list first? (as that’s the bottleneck by the looks of things).

We run a plugin that gives us custom menu links so we could simply add a new link directly to the map if it was available on a direct /url somehow? :thinking:

You could add a direct link in the Hamburger menu using Custom hamburger menu links, the link is:


However, please note that the user directory takes a very short time to load as it’s only loading one page. Even if it visits that route first and then transfers, you will find the majority of the time is spent loading the large number of users in one go for the map, as it’s much much harder to ‘page’ for a map view.


Thanks @merefield that’s exactly what we had tried :slight_smile:

Alas, it still pauses to load the User List page first, then it redirects to the map.

I was hoping just the map might be available on /map or something :slight_smile:

1 Like


But it’s a red herring.

The vanilla User List is cached so it loads in a split second. The issue is the length of time it takes to load the model for the map, which in your case is ~400 users in one go … so yeah, the User List rendering is wasting 0.1% of the processing time, but the real problem is the latter part. There may be no quick solution to that.

I know this partly because I just deployed to a site which hasn’t used this facility previously. The map data loads so quickly that User List is never visible (despite it loading first). The rub? Only 2 users have so far pinned their location … the User Map doesn’t scale well with its current architecture.


Interesting insight, thanks.

We only have around 12% of our community members on the map at the moment and we were recently discussing a drive to get more members on there.

Would I be right in thinking that as our community continues to grow, we can expect the map loading to get slower and slower?

1 Like

I’m guessing too that it has to load the user list first?

Knowing nothing about the code, is it possible to just have the map on it’s own somewhere? :thinking: :man_shrugging:

1 Like

Like I said, that’s irrelevant. The user list is cached and very short.

1 Like

Does the Locations plugin use its own model for this or an existing core one? I’m wondering where the bottleneck in selecting just 400 rows of user information from the database is?

Sorry for all the questions @merefield just trying to better understand how it works under the hood :slight_smile:

1 Like

No problem Richie. We override the DirectoryItemsController to pull back more people in one go than would normally occur when the data is paged for the normal table. The model is no different.

This really needs a root and branch replacement with a much more complex data streaming system that is aware of the viewport size and location. That’s quite a lot of work I suspect. Not least because that will no longer be able to leverage as much of the code that comes with Discourse, it’s a completely different use case. Quite an interesting piece of work though!

The fact that you are seeing this delay every single time suggests its not caching, and that could be something we might be able to fix without massive changes.


I haven’t missed or changed a simple Discourse setting have I?? :man_facepalming:

1 Like

No, it’s not your issue, except that you may have outgrown the current capabilities of the plugin :slight_smile:

When I get chance, I’ll look into what it might take to cache the results so you will only experience that issue once per session. That’s the low hanging fruit.

The bigger tree surgery however …

1 Like


Thanks @merefield but hang fire on that one. I have no evidence either way but my suspicion would strongly be that people only ever look at the map once per session anyway :thinking:

1 Like

A bug report.

This bug has been around for a while, but I finally figured out the locations plugin is to blame. When I have the plugin disabled, my website shows up correctly on the user card, but when I enable it, it shows up twice! Here’s a screenshot from the user card that appears on hover:

and another from the fully expanded profile page:

I have tested this many times by playing with combinations of changing the values in the profile. The only time I see it appear correctly, that is the website shows only once is if I disable the Locations plugin.

1 Like

Thanks Kartik, are you on a recent update?

1 Like

Yes, I should have mentioned it.

EDIT: The HTML generated for the duplicate element:

<span id="ember858" class="ember-view">  <div id="ember860" class="user-location-and-website-outlet replace-location ember-view"><!----><div class="user-profile-website">
  <svg class="fa d-icon d-icon-globe svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#globe"></use></svg>
    <span title="http://ks.cs.uchicago.edu">ks.cs.uchicago.edu</span>

I’m tied up with client work atm, but will keep this one in mind in the run up to the next supported upgrade period (1-5th of next month).

1 Like