Discourse plugin that requires login to view closed topics. Anonymous users (including search crawlers) see a login prompt instead of topic content.
Closed topics often contain stale information - outdated instructions, deprecated features, old troubleshooting steps. By gating them behind login:
- Search engines stop indexing outdated content
- Anonymous visitors are guided toward current resources
- Existing users retain full access to historical discussions
Works with Discourse's auto-close feature (e.g., close topics after 7 days of inactivity) to automatically gate aging content.
Contact Discourse support and request installation of:
https://github.com/superfly/discourse-closed-topic-gate
They'll clone the plugin and rebuild your instance.
SSH into your Discourse instance:
cd /var/www/discourse/plugins
git clone https://github.com/superfly/discourse-closed-topic-gate
cd /var/www/discourse
RAILS_ENV=production bundle exec rake plugin:install_all_gems
RAILS_ENV=production bundle exec rake assets:precompile
sv restart unicornTwo settings in Admin → Settings → Plugins:
| Setting | Default | Description |
|---|---|---|
closed_topic_gate_enabled |
true | Master switch for the plugin |
closed_topic_gate_demo_mode |
true | When on, only staff see the gate (for testing) |
The plugin installs with demo mode enabled. This lets you verify the gate works without affecting real users:
| User Type | Sees Gate? |
|---|---|
| Staff | Yes (for testing) |
| Logged-in non-staff | No |
| Anonymous | No |
To test:
- Log in as staff
- Visit any closed topic
- You should see Discourse's login prompt instead of the topic content
- Open the same URL in incognito - should see normal topic content
Once you've verified the gate works:
- Go to Admin → Settings → Plugins
- Set
closed_topic_gate_demo_modeto false
Now the behavior flips:
| User Type | Sees Gate? |
|---|---|
| Staff | No |
| Logged-in | No |
| Anonymous | Yes |
Temporarily: Set closed_topic_gate_enabled to false in Admin → Settings. Takes effect immediately, no restart needed.
Permanently: Contact Discourse support to remove the plugin (hosted), or for self-hosted:
rm -rf /var/www/discourse/plugins/discourse-closed-topic-gate
cd /var/www/discourse && sv restart unicornThe plugin prepends to Guardian#can_see_topic?, the standard Discourse permission check for topic visibility. When a closed topic is requested by an anonymous user (in production mode), it returns false, triggering Discourse's built-in login prompt.
This gates both the web view and the JSON API uniformly.