PHPackages                             wszdb/flarum-autolock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wszdb/flarum-autolock

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

wszdb/flarum-autolock
=====================

Automatically lock discussions after reaching a specified number of posts

v2.4(7mo ago)165MITPHPPHP ^8.2CI passing

Since Oct 7Pushed 7mo agoCompare

[ Source](https://github.com/wszdb/flarum-autolock)[ Packagist](https://packagist.org/packages/wszdb/flarum-autolock)[ RSS](/packages/wszdb-flarum-autolock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Flarum Auto Lock Extension
==========================

[](#flarum-auto-lock-extension)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)[![Flarum](https://camo.githubusercontent.com/3cba3fa5e294fd6b1496b24277c41b632b852165177b0076ae5ce28d05e4f5de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666c6172756d2d253545312e382e302d6f72616e67652e737667)](https://camo.githubusercontent.com/3cba3fa5e294fd6b1496b24277c41b632b852165177b0076ae5ce28d05e4f5de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666c6172756d2d253545312e382e302d6f72616e67652e737667)[![PHP](https://camo.githubusercontent.com/30d638e800a73d7685f7cf7355361f4a55e3fe82701f3aa06437686416304d77/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d707572706c652e737667)](https://camo.githubusercontent.com/30d638e800a73d7685f7cf7355361f4a55e3fe82701f3aa06437686416304d77/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d707572706c652e737667)[![Version](https://camo.githubusercontent.com/bcc7b4bf040d82e6eb31b8744c1d560d6550151b93d1b57f405d582d3c6d2f10/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e322e302d677265656e2e737667)](https://camo.githubusercontent.com/bcc7b4bf040d82e6eb31b8744c1d560d6550151b93d1b57f405d582d3c6d2f10/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e322e302d677265656e2e737667)

🔒 Automatically lock discussions when they reach a specified number of posts.

🔒 Flarum 贴子自动锁定插件，设置后，某个贴子回复数量超过特定楼层时，自动锁定，同时支持对特定标签（Tags）锁定豁免.

✨ New in v2.4.0
---------------

[](#-new-in-v240)

- 🏷️ **Tag Exemption**: Configure specific tags to be exempt from auto-locking
- 🎛️ **Multi-Tag Support**: Select one or multiple tags for exemption
- 🌐 **Enhanced UI**: Intuitive tag selector in admin panel

Features
--------

[](#features)

- ✅ **Automatic Locking**: Discussions are automatically locked when reaching the configured post count
- 🏷️ **Tag Exemption**: Exempt specific tags from auto-locking (NEW in v2.2)
- ⚙️ **Configurable Threshold**: Set custom post count threshold in admin panel (default: 100)
- 🎛️ **Enable/Disable Toggle**: Easy on/off switch in admin settings
- 🌍 **Multi-language Support**: English and Simplified Chinese included
- 🚀 **Event-Driven**: Uses Flarum's native event system for optimal performance
- 🔧 **Zero Configuration**: Works out of the box with sensible defaults
- 📊 **Detailed Logging**: Comprehensive logs for debugging and monitoring

Installation
------------

[](#installation)

Install via Composer:

```
composer require wszdb/flarum-autolock
```

Enable the extension:

```
php flarum extension:enable wszdb-autolock
```

Clear cache:

```
php flarum cache:clear
```

Configuration
-------------

[](#configuration)

1. Navigate to **Admin Panel** → **Extensions**
2. Find **Auto Lock** extension
3. Click **Settings** button
4. Configure options:
    - **Enable Auto Lock**: Toggle to enable/disable the feature
    - **Post Count Threshold**: Set the number of posts after which discussions will be locked (minimum: 1, default: 100)
    - **Exempt Tags**: Select tags that should be exempt from auto-locking (NEW in v2.2)

How It Works
------------

[](#how-it-works)

### Post Count Calculation

[](#post-count-calculation)

The extension uses the following formula to calculate total posts:

```
Total Posts = comment_count (replies) + 1 (original post)

Example:
- Original post = Floor 1
- 99 replies = Floor 2-100
- Total = 100 floors

When total >= threshold → Auto lock ✅

```

### Tag Exemption (v2.2)

[](#tag-exemption-v22)

Discussions with exempt tags will never be auto-locked, regardless of post count:

1. Admin selects exempt tags in extension settings
2. When a post is published, the extension checks discussion tags
3. If any tag matches exempt list → Skip auto-lock
4. Otherwise → Apply normal threshold logic

[![局部截取_20251012_114438](https://private-user-images.githubusercontent.com/202256400/500221434-6a594ab5-9f83-4ebd-9ad0-b5ca08cce703.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1ODkxODMsIm5iZiI6MTc3NTU4ODg4MywicGF0aCI6Ii8yMDIyNTY0MDAvNTAwMjIxNDM0LTZhNTk0YWI1LTlmODMtNGViZC05YWQwLWI1Y2EwOGNjZTcwMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNDA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDQwN1QxOTA4MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NTNiODM4ODNlNmJhMTRlNjMzMDYyNGIwY2RmMTU2NDIyNWQ5NzQ4ZTMyZDVhMDk4MGUzNTFkYmNlNjhlMjE0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.zTffZYuoN36mZ1TackR37LYjlzm6UHCAXOLcJ_mwoMU)](https://private-user-images.githubusercontent.com/202256400/500221434-6a594ab5-9f83-4ebd-9ad0-b5ca08cce703.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1ODkxODMsIm5iZiI6MTc3NTU4ODg4MywicGF0aCI6Ii8yMDIyNTY0MDAvNTAwMjIxNDM0LTZhNTk0YWI1LTlmODMtNGViZC05YWQwLWI1Y2EwOGNjZTcwMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNDA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDQwN1QxOTA4MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NTNiODM4ODNlNmJhMTRlNjMzMDYyNGIwY2RmMTU2NDIyNWQ5NzQ4ZTMyZDVhMDk4MGUzNTFkYmNlNjhlMjE0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.zTffZYuoN36mZ1TackR37LYjlzm6UHCAXOLcJ_mwoMU)### Trigger Logic

[](#trigger-logic)

1. When a new post is published, the extension listens to the `Posted` event
2. It refreshes the discussion data and calculates total posts
3. Checks if discussion has any exempt tags (v2.2)
4. If total posts ≥ threshold and discussion is not locked, it locks the discussion
5. All actions are logged for monitoring

License
-------

[](#license)

This extension is licensed under the [MIT License](LICENSE).

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/wszdb/flarum-autolock)
- [GitHub Repository](https://github.com/wszdb/flarum-autolock)
- [Flarum Community](https://discuss.flarum.org)
- This plugin is fully automatically developed using [AiPy](https://www.aipyaipy.com). Invitation Code: XOFS.
- 本插件使用[AiPy](https://www.aipyaipy.com)全自动开发完成，邀请码：XOFS.

---

**Developed by** [wszdb](https://github.com/wszdb)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance65

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

211d ago

Major Versions

v0.1 → v2.0.02025-10-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/206fdad6f04e67cdf50359bafd70941f93ddf0488ae4c35513f08bdbf361a66c?d=identicon)[wszdb](/maintainers/wszdb)

---

Top Contributors

[![wszdb](https://avatars.githubusercontent.com/u/202256400?v=4)](https://github.com/wszdb "wszdb (14 commits)")

---

Tags

aipyappflarumflarum-autolockflarum-extflarum-extensionflarum-lockextensionflarummoderationauto-lock

### Embed Badge

![Health badge](/badges/wszdb-flarum-autolock/health.svg)

```
[![Health](https://phpackages.com/badges/wszdb-flarum-autolock/health.svg)](https://phpackages.com/packages/wszdb-flarum-autolock)
```

###  Alternatives

[fof/analytics

Tracks analytics using Google Analytics, Google Optimize/GTM and Matomo

3543.1k](/packages/fof-analytics)[fof/sitemap

Generate a sitemap

1988.7k2](/packages/fof-sitemap)[fof/mason

Add custom fields to discussions

206.0k](/packages/fof-mason)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
