# Assign new users to a group automatically

**URL:** https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374
**Category:** Development
**Created:** [September 19, 2017, 4:04pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374 "2017-09-19T16:04:30Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 4:04pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/1 "2017-09-19T16:04:30Z")

</div>

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:

![](https://global.discourse-cdn.com/meta/original/3X/7/b/7b7223b808ac9f1b1b7aed09f7f05ef017e76679.PNG)

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!!

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 4:05pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/2 "2017-09-19T16:05:13Z")

</div>

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

 ![IMG_2806](https://global.discourse-cdn.com/meta/original/3X/b/a/bad3c977b672c9691ddd76165094bdb0c6eb5b7c.jpg)

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [September 19, 2017, 4:21pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/3 "2017-09-19T16:21:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 19, 2017, 4:35pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/4 "2017-09-19T16:35:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 19, 2017, 4:44pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/5 "2017-09-19T16:44:13Z")

</div>

Example CSS selector for targeting the full-name box:

```css
.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";
}

```

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 4:53pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/6 "2017-09-19T16:53:11Z")

</div>

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 Community Forum](https://community.webcore.co)**
>
> This is the community forum for the web-enabled Community's own Rule Engine

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.

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 4:58pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/7 "2017-09-19T16:58:32Z")

</div>

> [@riking](#):
>
> Example CSS selector for targeting the full-name box:

That looks like what we need 😃

But I’m a complete novice with CSS 😭

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

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 19, 2017, 4:59pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/8 "2017-09-19T16:59:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 5:00pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/9 "2017-09-19T17:00:59Z")

</div>

Thank you… I’ll give this a shot.

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 19, 2017, 5:03pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/10 "2017-09-19T17:03:35Z")

</div>

> [@riking](#):
>
> 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.

Not sure I follow?

20Char

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [September 20, 2017, 12:11am UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/11 "2017-09-20T00:11:11Z")

</div>

> [@Ultim8](#):
>
> Not sure I follow?

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

---

<div class="post-metadata">

### Author: ![Ultim8](https://avatars.discourse-cdn.com/v4/letter/u/ebca7d/32.png) [@Ultim8](https://meta.discourse.org/u/Ultim8)
#### Post date: [September 24, 2017, 9:17pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/12 "2017-09-24T21:17:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 18, 2019, 2:32pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/13 "2019-10-18T14:32:24Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 2, 2023, 6:04pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/16 "2023-08-02T18:04:23Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 1, 2023, 6:04pm UTC](https://meta.discourse.org/t/assign-new-users-to-a-group-automatically/70374/17 "2023-09-01T18:04:29Z")

</div>

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