Assign new users to a group automatically

Hey everyone, just signed up here but been using Discourse for a while now with a community that has just surpassed 400 users.

As the topic title suggests, we’re hoping there is a way to automatically add new users to a specific group. This is so they can be flagged as ‘Not Verified’ using CSS as per the following snapshot:

An alternative could be to have the red flag show for users not in a specific group, but I’m not sure how to do this in the CSS.

Any help / guidance will be much appreciated!!

1 Like

This is the CSS used to form the banner for the ‘new user’ group.

1 Like

I notice that your own username above has a new-user class on it, so you could add content after that.

Could you just use that existing class, or do you need the group for accomplishing something else?

1 Like

You might solve this problem the other way. That is, style everyone NOT in the Verified group as “Not Verified”.

I’ll leave the CSS to someone else.

3 Likes

Example CSS selector for targeting the full-name box:

.topic-post.regular:not(.group-non_ST):not(.group-staff):not(.group-verified_ST)
article:not([data-user-id="1234"]):not([data-user-id="4567"]) // special user IDs
.full-name:not(.staff):not(.non_ST):not(.verified_ST):after {
  content: "Not Verified";
}
5 Likes

That wouldn’t really work for us as a new user could easily progress to trust level 1 before we’ve had a chance to do the verification, and hence the banner would disappear too soon.

At present we are manually adding new users to a group called ‘New_User’ and adding the content based on that group.

To help describe the logic behind the madness I’ll try to explain the circumstances.

Our forum is this:

WebCoRE (WC) is a smartapp that runs on the Samsung SmartThings (ST) platform and our WC forum is a breakaway group from the much much larger ST forum (which is also powered by Discourse).

As the vast majority of WC users are already users on the ST forum, we want them to have priority over their existing usernames, to avoid confusion and maintain consistency between the two forums. We also don’t want our users impersonating established users on ST.

Our current process is as follows:

  • When someone signs up we manually place them in a group called ‘New_User’ which gives them the red flag next to their names,
  • Then, as time permits, we manually check if their name exists on the ST forum and if it does we move them to a group called ‘pending_verification’ and the red flag remains.
  • If it’s a unique name they are moved to a group called ‘non_ST’ and the rad flag goes away.
  • Unverified users are instructed (via pinned thread banner and welcome email) to send one of the admins a PM on the ST forum, confirming they are the same user, and we then move them to a group called ‘verified_ST’ (and red flag is removed).

What we want to achieve is to have all new users automatically assigned the red flag, immediately upon signup, as at present it is a manual process and they can chat away on the forum for a few hours before one of the admins assigns them to a group.

1 Like

That looks like what we need :smiley:

But I’m a complete novice with CSS :sob:

Would you mind posting a complete example targeting just the ‘not’ groups rather than the full names?

Oh, I’m sorry, it was a complete example. The whole thing was supposed to be used all together.

Also, change request: why is the complete list of user groups on the .full-name element? It would make more sense to be one level up from that.

3 Likes

Thank you… I’ll give this a shot.

Not sure I follow?

20Char

He was making a feature request to the Discourse team. That comment was not directed at you :smiley:.

3 Likes

So… we now have a CSS guru on our team, he took the above example and came up with this:

.topic-post.regular:not([class*=_]) .username:after {
content: “user verification not started”;
/* … */
}

All of our group names contain an underscore ‘_’ which massively simplified the code.

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.