National Flags - Display user nationality in Discourse


(Andy Cleff) #41

@Ebs Thanks for this add on! Works wonderfully.

As a member of a discourse board, I would like to be able to see people listed by country.

Use cases include

  • The ability to see everyone in the same location as myself
  • The ability to search by county, in advance of a trip, to see who’s there

Here’s a table view, from another non-discourse site:

The location on that sample is country plus city…

But since this add on is country only, start there.


(Makary Gołosz) #42

Submitted a PR adding Polish :poland: locale :slight_smile:


(Yaw Anokwa) #43

This is a must have feature for me too, Abram. The question is, how would you distinguish between this location and the location that Discourse already has? Would you just use the Discourse location? Would you have a new National flag location?


(Abram Bailey) #44

We ended up doing this on my site my forking the plugin: GitHub - bdeterling/discourse-nationalflags: National Flags plugin for Discourse

We just used the user-inputted location.

Here’s a screenshot:

image

Here’s the CSS we used to make it look decent:

.nationalflag-post {
width: 16px;
}

.nationalflag-location {
margin-top: -3px;
font-style: italic;
color: #6f6f6f;
font-size: 11px !important;
}

.username + .nationalflag-location, .username + .nationalflag-post {
display:block;
margin-left:0;
}

See it in action on our hearing forum here Oticon Opn1 minirite 85s appropriate for my loss? - Hearing Aids - Hearing Aid Forum - Active Hearing Loss Community


(Yaw Anokwa) #45

@Ebs any chance you would pull in @abrambailey’s changes if he sent in a PR?


(Makary Gołosz) #46

First of all, it seems too small to be legible for me. And another thing - wouldn’t it be easier to put custom css in the theme than changing the plugin?


(Allen) #47

This is exactly our use case as well. @Ebs, any chance of this happening?


(Tobias Eigen) #48

Here’s a screenshot of that post @abrambailey links to above for those who may not want to click on it - it looked a bit spammy to me. :wink:. (edited: that came across a bit strong. sorry about that)

We use SSO with WordPress and thanks to @AdamCapriola already have API code for adding/removing users to certain discourse groups via WordPress. One answer to this use case might be to create location-based discourse groups, also managed via the API. Users could then look at the group members list to see who is in the same location as themselves, and be given permission to mention people in their own location in discussions or to start personal messages.

Alternatively, this plugin could be extended to create a discourse group for that location to it and add the user to it. You’d probably want to be careful not to create hundreds of groups that mean nothing because they have nobody in them.

This can lead to information overload in some instances so you’d want to be careful how you set this up. For example mentioning @kenya in my community would lead to hundreds of notifications if you also disable some other safeguards around mentioning.


(Allen) #49

Hmm, maybe a misunderstanding? :confused:

I rather meant something like this:


see this post:


(Tobias Eigen) #50

Ahh. No worries, didn’t mean anything by it. Also missed that you had a screen shot of your own in that post.

The idea is a good one. It’s just a question of how we get there. I like to see plugins that leverage existing functionality rather than building out too much new stuff in plugins.


(Allen) #51

No worries either :wink: How about just adding the flag as an additional column on the existing user list, sortable like all the other columns? Would that fit your criteria re leveraging existing functionality? :grinning:

Perhaps something like this?


(Tobias Eigen) #52

The user list is oriented more towards activity than demographics.

Maybe a model for you would be cakeday.

https://meta.discourse.org/cakeday/anniversaries/today

Or the groups page, which could benefit from demographic info about the people in the group. I for one would be interested to know who in the groups I am in are nearby or where they are. Maybe not on meta but in my community.

https://meta.discourse.org/groups/plugin_authors


(Tobias Eigen) #54

Don’t worry about it - I updated my post.


(Tobias Eigen) #56

This is off topic - let’s wrap up this side conversation. I will send you a PM. :slight_smile:


(Allen) #57

Thanks for your input. Unfortunately, none of those really wok for my use case (and I suppose neither for @Andy_Cleff ). I am investigating if we can move a patient group from phpBB to Discourse. The patients often want to get in contact with other patients living in the same country (perhaps for setting up local conferences etc.). So what I would basically need is some kind of directory, where the patients (only user name, no further details) are listed along with their country, and perhaps some configurable custom use fields to go along with it.

Wordpress for example has standard functionality that will fulfills this need. I guess in the Discourse status quo we are probably talking about a custom plugin at this stage. @ebs, I would want to integrate your flag functionality though. Would you be interested in increasing the scope of your plugin on a paid basis, or should we fork your plugin, or should we extend it and submit a PR?


(Tobias Eigen) #58

In my community, we have a member directory in wordpress. Details are updated in discourse via API so they are kept in sync. This works reasonably well, but doesn’t allow members to quickly contact each other based on their location.

It would be neat to see this in discourse, and you’re right that it seems to be heading down the path of a custom plugin.

Have you looked at the locations plugin? appears to be more about topics than users, but still perhaps something you can get involved in to add in the ability to plot and see users on a map based on their location field.


(Ivan Rapekas) #59

Hello @Ebs , possible due to hardcoded path below the pictures do not appear in the environment located in folder (/forum) instead of root (/). Is there any way to fix it without nginx proxy?


(Craig Davison) #60

I’ve just released a modifed version of this which includes the latest up-to-date plugin + @abrambailey’s modifications + support for the Locations Plugin user field. Would be good to get this merged in. GitHub - davisonio/discourse-nationalflags: National Flags plugin for Discourse

Edit: Ok it doesn’t work lol…if anyone knows what’s up let me know


(Diego Barreiro) #61

This happens on mobile:

Using latest plugin and Discourse versions


(Jay Dawg) #62

go to admin settings customize click on mobile and add for quick fix

.nationalflag-post {
    width: 24px !important;
    height:18px !important ;
    vertical-align: top;
}