I’m trying to add self-service pronoun badges for my discourse, and not sure what the best way to go about it is. Seems like self-service badges don’t exist yet, so I’d have to hack something up.
Best idea from a UX point of view is maybe create a special post and people could reply to the post with the pronouns they prefer, and a sql query could then find the reply and assign the right badge?
Is there something simpler than that, that I haven’t thought of?
I’m not quite sure exactly what you’re trying to accomplish, but you can create a custom user field and have people put their pronoun(s) there.
What do you mean by a “badge”? Discourse has Badges, but I don’t think that’s what you mean, or maybe it is. If you do mean badges, then you can enable Badge SQL and have them be assigned when someone populates the pronoun field in their profile.
Ahh, a custom pronoun field in profile is a good start. The problem is that I’m generally not going to go look at someone’s profile before responding to them.
The reason I was thinking of doing it as a badge is to make it so it’s more visible… There’s “Allow badge to be used as a title” … which I presume means you can have it shown up by someone’s name… but maybe not?
You can have the pronoun field show in their card, which is less of a drag than going all the way to the profile.
With some work you could have a theme component display their pronoun field . . . somewhere.
Hmm, yeah, I tried it on the card, that’s not bad. I was thinking after the user’s primary group… but I worry that is making that line pretty busy. Also I don’t relish tweaking the theme.
That’s my concern. Do all of your users really want to scream their pronouns on every. single. message? And coming up with groups has its own set of problems, as you’ll necessarily be limiting the set of pronouns that people can use. The CSS solution could stick the value from the custom field after their name and/or primary group. I don’t relish doing CSS stuff either, but my guess is that you can get someone here to tell you how to do it. Worst case, it’s a few hundred dollars, I’d think.
This topic shows how to add a user custom field after the poster’s name: Ability to place custom fields in post header?
Ha. I was right, and they didn’t even have to ask!
Do I need to make a plugin to add that script?
No, just create a theme component and add that code (modified for your custom variable) and add it to the
</head> section of the theme component. Then add that theme component to whatever theme(s) you are using.
For those, like me, who didn’t know how to make a theme component, you can do it right from your site, just go to Themes under settings, and click the component tab, click install, and then click create. Bam.
(Clicking install to create a new one was weird, but I figured it out).
Ok, uh, is there a trick to get it to… work? It looks correct when I click
Make sure that you have added the component to your site’s theme. There are details about that here: How do I install a Theme or Theme Component?. You might also want to look at Developer’s guide to Discourse Themes.
That did it. Thanks, I didn’t realize I had to also add it to the theme, but that makes sense.
Taking a leaf from social networks why not just add your preferred pronouns at the top of your profile?