# 国旗

**URL:** https://meta.discourse.org/t/national-flags/55969
**Category:** Plugin
**Tags:** broken
**Created:** [2017年一月18日 15:13 UTC](https://meta.discourse.org/t/national-flags/55969 "2017-01-18T15:13:40Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年三月2日 11:56 UTC](https://meta.discourse.org/t/national-flags/55969/21 "2017-03-02T11:56:26Z")

</div>

> [@JagWaugh](#):
>
> Have you enabled it in /admin/site\_settings/category/plugins?filter=nationalflag?

That would have been a nice solution, but yes, it’s enabled.

Edit: Whooops. Now the National Flag option has magically appeared. Maybe this was a caching thing…

---

<div class="post-metadata">

### Author: ![Ebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ebs/32/119612_2.png) [@Ebs](https://meta.discourse.org/u/Ebs)
#### Post date: [2017年三月2日 12:02 UTC](https://meta.discourse.org/t/national-flags/55969/22 "2017-03-02T12:02:43Z")

</div>

@tophee, you said in the other thread that you’d disabled it  
EDIT: glad its working now.

@JagWaugh I updated the plugin last night to hopefully fix the warning messages once and for all. It’s been running on my forum since then and (so far) no warnings.

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月2日 12:05 UTC](https://meta.discourse.org/t/national-flags/55969/23 "2017-03-02T12:05:46Z")

</div>

Just updating the live site now…

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月2日 12:38 UTC](https://meta.discourse.org/t/national-flags/55969/24 "2017-03-02T12:38:23Z")

</div>

Still getting:

> Uncaught exception: TypeError: Cannot convert ‘e.attrs.userCustomFields’ to object

> Uncaught TypeError: Cannot read property ‘nationalflag\_iso’ of null

> TypeError: e.attrs.userCustomFields is null

I take it that none of these are browser cache issues?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年三月2日 12:43 UTC](https://meta.discourse.org/t/national-flags/55969/25 "2017-03-02T12:43:35Z")

</div>

Since this topic is now the main place to discuss the plugin, I want to just mention a feature request I made elsewhere:

> [@National flags indicating home country of each user?](https://meta.discourse.org/t/national-flags-indicating-home-country-of-each-user/53555/11):
>
> I wonder whether it would be too much trouble to extend the functionality to allow users to add multiple flags. I guess the reasons are obvious but let me just give an example: I am about to build a website for a global community of people who are themselves often highly mobile internationally so that it makes little sense to them to select a single national identity, such as “I am German” or “I am from Germany”. What makes sense in this context (and I think increasingly for many people) is to say “I’m of German descent, born in Indonesia and living in the UK”. Putting three flags would nicely sum that up…

To put it more technically, can we let users choose a secondary National Flag right below the present flag setting? The scondary flag would be displayed next to the first one.

---

<div class="post-metadata">

### Author: ![Ebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ebs/32/119612_2.png) [@Ebs](https://meta.discourse.org/u/Ebs)
#### Post date: [2017年三月2日 12:55 UTC](https://meta.discourse.org/t/national-flags/55969/26 "2017-03-02T12:55:52Z")

</div>

Andrew, where are you seeing these exactly? Local Browser console or site/logs? I haven’t seen anything like these since the update last night. (admittedly, my own forum is low traffic)

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月2日 13:03 UTC](https://meta.discourse.org/t/national-flags/55969/27 "2017-03-02T13:03:01Z")

</div>

They are in /site/logs. Only 8 users online atm, 5 or so of them were online before and while I ran the last update (hence the cache question).

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月2日 14:00 UTC](https://meta.discourse.org/t/national-flags/55969/28 "2017-03-02T14:00:31Z")

</div>

2 more “e.attrs.userCustomFields is null”. Judging by the timestamps these seem to be happening when a user replies to a post via the web interface. (i.e. they aren’t being triggered by someone just looking at posts.)

I’m not sure if that is much help to you.

---

<div class="post-metadata">

### Author: ![Ebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ebs/32/119612_2.png) [@Ebs](https://meta.discourse.org/u/Ebs)
#### Post date: [2017年三月2日 14:31 UTC](https://meta.discourse.org/t/national-flags/55969/29 "2017-03-02T14:31:40Z")

</div>

It’s a big help, thanks.  
I thought I’d fixed this. In the decorator, I check to see if that value is not null before carrying on with adding the flag (when a new post is made). Obviously missed something though. if it’s causing problems, I’d recommend just disabling the plugin until it’s completely fixed. I’ll try and have a look again over the weekend.

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月2日 14:45 UTC](https://meta.discourse.org/t/national-flags/55969/30 "2017-03-02T14:45:34Z")

</div>

> [@Ebs](#):
>
> if it’s causing problems, I’d recommend just disabling the plugin until it’s completely fixed

And risk a user revolt, are you mad???

I’m ok to keep running with it if it helps you narrow in on what is causing the error messages. Our forum is fairly active, with a relatively number of users using both the web and the email interface. I haven’t actually announced the nationalflags yet, so only a few have figured it out on their own, or asked.

Some more data points since the update this morning:

I’ve had one user with no flag defined create a new topic via the web interface, and this did not generate a “nationalflags” error in /logs

Replies via email, from users with no flag defined do not generate the error.

Not every reply or new topic from a user with no flag defined seems to raise the error.

hth.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年三月3日 02:02 UTC](https://meta.discourse.org/t/national-flags/55969/31 "2017-03-03T02:02:01Z")

</div>

I also have an error for you:

```
TypeError: Cannot read property 'nationalflag_iso' of null
	at https://forum.example.net/assets/plugin-third-party-015118efc2c13c2c90bcfcc6beece348477a2141a2a4ebcfc245d5cd96a19deb.js:2:28629
	at https://forum.example.net/assets/application-e8be41068653f348d6bb73e96add1db5ffb5938f989f70ef4bc22a3beb3a16ec.js:45:15286
	at Array.map (native)
	at https://forum.example.net/assets/application-e8be41068653f348d6bb73e96add1db5ffb5938f989f70ef4bc22a3beb3a16ec.js:45:15263
	at d (https://forum.example.net/assets/application-e8be41068653f348d6bb73e96add1db5ffb5938f989f70ef4bc22a3beb3a16ec.js:45:15294)
	at t.m [as draw] (https://forum.example.net/assets/application-e8be41068653f348d6bb73e96add1db5ffb5938f989f70ef4bc22a3beb3a16ec.js:45:16123)
	at t.value (https://forum.example.net/assets/application-e8be41068653f348d6bb73e96add1db5ffb5938f989f70ef4bc22a3beb3a16ec.js:45:18782)
	at r (https://forum.example.net/assets/vendor-52ed1f7ea87a692ca7ec8f3b75bb76997f730cae151edfe8f467849ef9ddde78.js:7:14880)
	at i (https://forum.example.net/assets/vendor-52ed1f7ea87a692ca7ec8f3b75bb76997f730cae151edfe8f467849ef9ddde78.js:7:14810)
	at i (https://forum.example.net/assets/vendor-52ed1f7ea87a692ca7ec8f3b75bb76997f730cae151edfe8f467849ef9ddde78.js:7:8247)

```

And you can read about some very weird behaviour that is possibly also related to the plugin here.[quote=“tophee, post:5, topic:58266”]  
I am using different browsers to login with as different users for testing purposes but before that error happened, I accidentally used a new tab in the same browser (Chrome) to login with a different account. When I went back to the tab with the original Chrome user, everything looked fine because I didn’t refresh the page and so I posted a reply. I was surprised to see that the reply I had just typed had the other users avatar. That’s how I realized that I had logged the other user in with Chrome rather than Firefox. So it made sense. But what didn’t make sense was that the Firefox user all of a sudden had the chrome user’s national flag next to it even though I had not touched that setting for that user.  
[/quote]

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [2017年三月4日 07:49 UTC](https://meta.discourse.org/t/national-flags/55969/32 "2017-03-04T07:49:54Z")

</div>

3h and 22 new posts since I updated to 59ab187… nationalflags would appear to no longer be causing error messages in /logs. Thanks @Ebs

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [2017年三月7日 07:54 UTC](https://meta.discourse.org/t/national-flags/55969/33 "2017-03-07T07:54:45Z")

</div>

@Ebs I also want this to show in registration form.

---

<div class="post-metadata">

### Author: ![dylanh724](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dylanh724/32/119642_2.png) [@dylanh724](https://meta.discourse.org/u/dylanh724)
#### Post date: [2017年五月9日 14:09 UTC](https://meta.discourse.org/t/national-flags/55969/34 "2017-05-09T14:09:47Z")

</div>

Works great!

I’d love to see a tooltip, however – sometimes people may not recognize certain flags. Give them an “ah” moment by hovering over the flag to reveal what country (or the ISO code, at least)

---

<div class="post-metadata">

### Author: ![Radulf](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Radulf](https://meta.discourse.org/u/Radulf)
#### Post date: [2017年五月16日 07:51 UTC](https://meta.discourse.org/t/national-flags/55969/35 "2017-05-16T07:51:19Z")

</div>

Hi, I’m trying to get this plugin to run, but unfortunately I fail. I’m currently using a development version so I just copy the plugin to the plugin folder. Unfortunately, the user settings to choose a flag do not appear in Preferences → Interface as they should according to the provided screenshot.

The plugin is activated in the Admin settings and deactivating and activating again does not help. There is also the option “nationalflag iso” in the settings, which I left at “none” as I have no idea what the option is for. Do I need to set it somehow? And how? Or does someone have an idea what could be wrong?

Thanks a lot!

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年五月16日 08:09 UTC](https://meta.discourse.org/t/national-flags/55969/36 "2017-05-16T08:09:55Z")

</div>

> [@Radulf](#):
>
> I just copy the plugin to the plugin folder.

Does it work if you install it the proper way via app.yml?

---

<div class="post-metadata">

### Author: ![Radulf](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Radulf](https://meta.discourse.org/u/Radulf)
#### Post date: [2017年五月16日 08:22 UTC](https://meta.discourse.org/t/national-flags/55969/37 "2017-05-16T08:22:13Z")

</div>

Unfortunately there is no app.yml in the development version. But when I tried it on another machine in the regular docker version it didn’t work either.

Also, it does appear in Discourse, as I do have the admin settings available. However, it’s not visible to any user that is not admin.

Edit: I discovered that I did not have Sidekiq running and now it’s not really working as it has around half a million jobs after importing the old forum. Could this be a reason for the plugin not working?

---

<div class="post-metadata">

### Author: ![Radulf](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Radulf](https://meta.discourse.org/u/Radulf)
#### Post date: [2017年五月17日 09:36 UTC](https://meta.discourse.org/t/national-flags/55969/38 "2017-05-17T09:36:04Z")

</div>

I set up a fresh productive discourse today. It’s version v1.8.0.beta12 +40 and up to date right now. Beside the e-mail settings I only added this plugin. The problem remains the same, i.e., it appears in the admin area, but not in the user settings.

---

<div class="post-metadata">

### Author: ![Ebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ebs/32/119612_2.png) [@Ebs](https://meta.discourse.org/u/Ebs)
#### Post date: [2017年五月17日 10:00 UTC](https://meta.discourse.org/t/national-flags/55969/39 "2017-05-17T10:00:44Z")

</div>

No idea what’s going wrong. Try another plugin, see if that works? Have a look at your logs, see if the plugin is being loaded at startup. Add some console.logs to the Javascript. Its hard to guess what the problem is without more information.

---

<div class="post-metadata">

### Author: ![abrambailey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abrambailey/32/119786_2.png) [@abrambailey](https://meta.discourse.org/u/abrambailey)
#### Post date: [2017年九月3日 19:52 UTC](https://meta.discourse.org/t/national-flags/55969/40 "2017-09-03T19:52:36Z")

</div>

Love this!

Any chance we could get the user’s manually entered location to load up right next to the flag? Like:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/9/6907f73c77a503483133325e699fcdf53b1de6f6.jpg)

[上一頁](https://meta.discourse.org/t/national-flags/55969.md?page=1)

[下一頁](https://meta.discourse.org/t/national-flags/55969.md?page=3)
