Skip to content

avocadoheather/nodebb-plugin-archive

 
 

Repository files navigation

NodeBB Archive Plugin

A NodeBB plugin that allows administrators and moderators to archive topics, making them read-only and hiding them from standard topic listings. Archived topics remain accessible via direct links and can be listed on a dedicated archive page.

Features

  • Archive/Unarchive Topics: Mark topics as archived with a simple button in the topic toolbar
  • Read-Only Enforcement: Prevent new replies to archived topics
  • Archive Listings: Dedicated /archive page to browse archived topics with pagination
  • Permission Control: Configurable permissions for who can archive topics
  • Admin Control Panel: Bulk archive operations and plugin settings
  • Search Integration: Optional inclusion/exclusion of archived topics in search results

Installation

From npm (when published)

npm install nodebb-plugin-archive

Manual Installation

  1. Clone or download this repository to your NodeBB's node_modules directory:
cd /path/to/nodebb/node_modules
git clone https://github.com/avocadoheather/nodebb-plugin-archive.git
  1. Install from NodeBB Admin Control Panel:

    • Go to Admin Control PanelExtendPlugins
    • Find "NodeBB Archive Plugin" and click Activate
  2. Or install via command line:

./nodebb activate nodebb-plugin-archive
./nodebb restart

Configuration

Admin Settings

Navigate to Admin Control PanelPluginsArchive to configure:

Setting Description Default
Allow topic owners to archive Let topic creators archive their own topics false
Include archived in search Show archived topics in search results false
Auto-archive after (days) Automatically archive topics after N days of inactivity 0 (disabled)

Bulk Operations

In the ACP Archive page, you can:

  • Enter comma-separated topic IDs (e.g., 123,456,789)
  • Click Archive or Unarchive to perform bulk operations

Usage

For Administrators/Moderators

  1. Archive a Topic:

    • Open any topic
    • Click the folder icon (📁) in the topic toolbar
    • Topic becomes read-only and gets archived
  2. Unarchive a Topic:

    • Open an archived topic
    • Click the open folder icon (📂) in the topic toolbar
    • Topic becomes active again
  3. View Archived Topics:

    • Visit /archive on your forum
    • Browse paginated list of all archived topics
    • Click any topic to view (read-only)

For Users

  • Archived topics are marked with visual indicators
  • Cannot reply to archived topics (composer is disabled)
  • Can still view archived topics via direct links
  • May or may not appear in search (depends on admin setting)

API Reference

REST Endpoints

All endpoints require authentication and appropriate permissions.

Archive/Unarchive Topic

POST /api/v3/plugins/archive/topic/:tid
Content-Type: application/json

{
  "archived": true
}

Response:

{
  "status": { "code": "ok", "message": "OK" },
  "response": {
    "tid": 123,
    "archived": 1
  }
}

List Archived Topics

GET /api/v3/plugins/archive/topics?page=1&perPage=20&cid=5

Response:

{
  "status": { "code": "ok", "message": "OK" },
  "response": {
    "topics": [...],
    "pagination": {
      "page": 1,
      "perPage": 20,
      "total": 45
    }
  }
}

Hooks

The plugin provides these hooks for other plugins:

  • action:archive.topic.set - Fired when a topic is archived
  • action:archive.topic.unset - Fired when a topic is unarchived

Permissions

By default, the following users can archive/unarchive topics:

  • Administrators (always)
  • Global Moderators (always)
  • Category Moderators (for topics in their categories)
  • Topic Owners (if enabled in settings)

Data Storage

The plugin stores:

  • Topic Field: archived flag (0 or 1) on each topic
  • Sorted Set: archive:topics (ordered by last post time)
  • Category Sets: archive:cid:<cid> for category-specific listings

Troubleshooting

Plugin not appearing in ACP

  • Ensure plugin is activated: ./nodebb plugins
  • Restart NodeBB: ./nodebb restart
  • Check NodeBB logs for errors

Archive button not showing

  • Verify you have admin/moderator permissions
  • Check if "Allow topic owners" setting matches your needs
  • Ensure you're viewing a valid, non-deleted topic

Bulk operations failing

  • Verify topic IDs are correct and exist
  • Check that you have permissions for all topics
  • Try smaller batches if dealing with many topics

Development

Testing

npm test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Changelog

v0.4.3

  • Initial archive functionality
  • Topic archiving with read-only enforcement
  • Archive page and admin settings
  • Bulk operations support

License

MIT License - see LICENSE file for details.

Support

About

A NodeBB plugin to create an archive.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 89.6%
  • Smarty 9.9%
  • Other 0.5%