A Discourse plugin that validates user membership numbers against an uploaded list and suspends users whose numbers are not found.
- Admin panel at
/admin/plugins/membership-validatorwith a textarea to paste membership numbers (one per line) - Preview mode — see exactly who will be affected before taking action, broken down into:
- Valid — membership number found in the list
- Invalid — membership number NOT in the list (will be suspended)
- Exempt — user is on the exempt list, won't be touched regardless
- No number — user has no membership number set (not affected)
- Exempt user list — add specific users (e.g. system accounts, generic posting accounts) who should never be suspended by this plugin
- Confirmation step — suspensions only happen after explicit admin confirmation
- Staff action logging — all suspensions are logged via Discourse's built-in staff action logger
- System messages — suspended users receive a system message explaining why
- Discourse 2.7.0+
- A User Custom Field named exactly
Membership Number(create this in Admin → Customize → User Fields)
Add to your app.yml containers config:
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/peter-bosch/discourse-membership-id-checker.gitThen rebuild: ./launcher rebuild app
After installation, go to Admin → Settings and search for membership_validator:
| Setting | Default | Description |
|---|---|---|
membership_validator_enabled |
false |
Master on/off switch |
membership_validator_suspension_reason |
"Your membership number was not found…" | Reason shown to suspended users |
membership_validator_suspend_days |
365 |
Duration of suspension in days |
- Enable the plugin in Admin → Settings
- Create the custom field "Membership Number" in Admin → Customize → User Fields (if it doesn't exist)
- Navigate to Admin → Plugins → Membership Validator
- Paste your current membership numbers into the textarea (one per line, or comma/semicolon separated)
- Click Preview Changes to see the breakdown
- Review the list of users that will be suspended
- Click Suspend Flagged Users and confirm
Scroll to the "Exempt Users" section at the bottom of the admin page. Type a username and click "Add exempt user". These users will never be suspended by this plugin, regardless of their membership number status.
Common use cases for exemptions:
- System/bot accounts
- Generic accounts used for site-wide announcements
- Staff accounts that don't have membership numbers
- The plugin reads
UserCustomFieldrecords wherename = "Membership Number" - It compares each user's value against the pasted list
- Admin users and already-suspended users are always skipped
- Exempt users are always skipped
- Matching is exact (whitespace-trimmed) — the membership number must appear exactly as entered
- Suspensions use Discourse's built-in suspension system (
user.suspended_till)
- Admin users are never suspended by this plugin
- Already-suspended users are skipped (no double-suspension)
- Users without a membership number are not affected — only users who have a number that doesn't match are suspended
- Suspensions can be manually reversed per-user through the normal Discourse admin interface
- The plugin does NOT automatically unsuspend users if their number later appears in a new list — that must be done manually
# Clone inside your Discourse dev plugins directory
cd /path/to/discourse/plugins
git clone https://github.com/peter-bosch/discourse-membership-id-checker.git
# Run migrations
cd /path/to/discourse
RAILS_ENV=development rake db:migrate
# Start Discourse
bin/ember-cli -u # frontend
rails s # backendMIT