Is it possible to set an expiration date for user accounts?

Every time a user registers with an invitation link, I would like that account to only last x months and once the deadline has reached the user must renew their account, is it possible to do so?

It is basically a membership with an expiration date and renewal. If this feature does not exist in Discourse, is it possible to program it through a plugin or something similar without touching the core? or is there no support in the API and webhooks for something like this?

1 Like

You’d add them to a group when they joined. You’d then have a plugin that removed them from the group after the time limit was up. Just how you’d keep up with the month isn’t clear. Probably a user custom field with the end date would be the most simple.

1 Like

“You’d then have a plugin that removed them from the group after the time limit was up.” which plugin?

“Probably a user custom field with the end date would be the most simple.” Do I add that information during signup? Then I should use a webhook at that point, correct?

There is no such plugin. Someone would need to write it.

No. The plugin would do that. And it’s likely that there’s a way to discern when they got added via the database and data explorer, though I’m not really sure.

If you’re not self hosted, or for other reason don’t want a plugin,
It might also be possible to hack something together using the data explorer plugin (to get data on when they were added and hence, should be deleted) and use an automation/api tool (like zapier, though I’ve also used github actions) to remove them from the group when the time comes.

This would be a nice candidate for an automation script! Does not exist yet so you could contribute it or hire someone to do it for you and contribute it, in Marketplace.

1 Like

I can do that, but with an extra feature: it should allow key-value fields to be added.

The idea is that I can associate information with an invitation link with the information I want. The values can be a simple string or a JSON, and each key is a column in the database. Then, when the user finishes registering, an extra key-value pair is added, which is their username.

My question is, will it pass your filters and be added to the native Discourse source code? And this leads me to an additional question, are invitation links always unique?

I slipped this topic across to Dev because we are moving out of support territory here. You need to just get going with creating the plugin or automation that does what you want. Let us know how you get on! If the features you add are more widely useful, they may be considered for inclusion eventually in core Discourse.

Refer to Documentation > Developer Guides and Community wiki > Developers for guidance on creating plugins.

You can also start more topics in Dev to ask more questions, but I do recommend you have code to share as you do so. It is easier for others to help you if they can see what you’ve done so far.

Yes, invitation links are always unique.

I don’t know what you mean by “pass your filters and be added to the native Discourse source code”.

These are the types of questions I think you will be able to find out for yourself as you dig into the code.

1 Like