Optional global invite code


A new options setting called invite_code was added.

When set, all accounts being registered must enter the invite code in order to be allowed account creation. Users without this code are not allowed to register an account.

If the invite is code is wrong user gets a helpful error:

Feature is 100% optional!. At the moment it is only compatible local auth however we will improve that in future iterations.

If you enable the global invite code it applies, if not it does not and the invite code will not appear in the registration dialog.


How does this make sense? Shouldn’t the code allow you to bypass staff new account approval?


The code is not about staff non staff this is 100% about new account registration.

The use case is posting on Whatsapp or a Facebook private group…

Hey I setup a forum for you, use the invite code “Welcome to Discourse” to register an account.

Since the site requires registration only people with the code are allowed access.

We can certainly extend this, but I have an ultra urgent use case for this so I got this done today and will refine next week.


I super duper do not understand the use case for this?

Why not turn on new account approvals and point people at the site?


That requires manual moderation of each account. This setting is really very useful for those looking to test out with a few users or those running some kind of promo with forum access being a perk. Such an invite code will almost dramatically reduce work loads for pilot project forums as well.


Because I need to approve every single email and sit on the approval queue 24x7 and I don’t have any idea if this is a random bot that registered is really someone that should have access or not.

With an invite code I know that at least they had an invite code that I shared privately.


But isn’t that the whole point of approve users.

1 Like

This will help us with our COVID-19 response platform too - yes please, ASAP!!!


+1 for this feature, which is hugely useful for a number of communities I run. I get @codinghorror @ondrejj point about manual approval above, but I think this fills a gap which exists between manually inviting everyone (‘invite only’ site) and manually approving everyone (‘approve’ users site).


We don’t want to approve users. We just want to post a code in a slack/telegram/whatsapp group and let everyone use it. Sometimes, a few extra testers before formal launch doesn’t hurt much.


Yeah, this feature would be immensely helpful right now! :smiley:


I also find this very useful, especially if the functionality is slightly extended so that it becomes possible to “attach” groups to a specific invite code, i.e. someone creating an account using a specific code is automatically added to a specific group.

In some use cases, this might also solve the request for email independent invite tokens that comes up from time to time…


How is this materially different than

at least they had an URL that I shared privately

Because honestly the way it is now I super don’t get this feature.


Having the option of entering a bypass code OR admin approval makes the most sense here.

1 Like

I am a fan of this in slightly different forms, it just needs some tweaking. If there is an urgent (?) need for it now then I guess that’s fine?

I just don’t personally feel that the magic domain

please sign up at https://forum.this-is-my-magic-domain.org

is a completely unusable and totally unworkable level of signup protection versus magic password

you must know the secret this-is-my-magic-password to access this site


There are two form of this that I am super happy to support

Please visit amazing.forum.com and enter the invite code: fantastic to gain access (implemented)


Please visit amazing.forum.com/register?code=fantastic to register and gain access to the forum

We have probably passed a rule of 100 here given our general way of solving this problem is placing sites behind HTTP basic auth.

Both are quite similar, I implement #1 for now but will follow up with #2.

#1 has the advantage that it is a bit easier when you are not relying on cut-and-paste, eg get instructions over whatsapp and then use the desktop to complete.

#2 has the advantage that it reduces typing in fantastic and is handy for an “email” share vs a whatsapp share.

Not following where forum.this-magic-domain.org came from here? In both cases this is exactly the same domain the forum is on.


Here’s a quick mock of what I thought the UI was going to look like for this:


(This is on a dev site with must_approve_users on, after email validation)

It should be optional at signup and optional at login-while-not-approved, because anything that mandates all users manage to copy the code around is going to break & need admin intervention.

Nope, guaranteed to leak. Farsight Security Passive DNS FAQ

This can work for time-boxed setups but not as a long-term posture.

1 Like

Why do you need an approval code AFTER you already created an account.

That means bots just register pointless accounts that you can eliminate way before they pollute your db?

Plus, your account is already registered, it may already be validated.

Also WTF, where is all this discussion about secret domains coming from.

If we enabled this on meta, for example:

Please visit meta.discourse.org and enter the code HELLOMETA to create an account.


I realize now I just accidentally reiterated @codinghorror’s points from the previous topic. (which I had not read at time of writing, due to this being in #feature:announcements )

Essentially, this should be building on top of must_approve_users + login_required instead of making an entirely parallel system. The current implementation is fine as a hack to get us through the current crisis, but should be fixed up.

Someone’s going to forget the code or not write it down if you present it at a conference. Or you need to cycle the code after the conf videos go up. It’s a lot better to ask in your whatsapp group “whose account is @test3?”, get an affirmative response, and click


instead of trying to coax them through copying the code into the signup form correctly. (note: these screenshots are after email validation.)

1 Like

I think it’s fine, we just need to get to the eventual tweaks. There are definitely some improvements I fully support here.

First, integration with the user invites page, e.g. if you sign up on meta via visiting the link https://meta.discourse.org/signup?u=codinghorror then you show up as someone I invited on my user profile page, like so:

Remember that email based invites already grant TL1 to those users you invited… so we already have that perk… check out the invite dialog… notice you can add group access, too, and the TL bump is implicit. We should probably spell this out in the copy here on this dialog, actually:

Second, you should be able to generate invite links with no email from the same place you send invites, per the above :point_up:… this completely resolves the “but I don’t know their email addresses :crying_cat_face:” problem.

Third, I think it’s fine for a site to be “invite only” and the invites are all in the form of hyperlinks plus a secret password. That way it’s

  • something you have (e.g. a link to a site)
  • something you know (e.g. the password open sesame)

And if your site has approvals, then the secret password lets you skip approval too. If you don’t have approvals, you can’t get in without the secret password…

My main issue is that we’re not integrating with the existing features here, rather bolting on some random stuff through an obscure site setting. But we can integrate, to make the invite feature even better rather than a weird standalone site setting.