Summary
Upgraded addon from v1.0.1 to v1.0.2, introducing real-time point/stat tracking (replacing cron), document forum validation, group-level attachment requirements, per-forum download costs, and a brand new Public Portal & Widgets for members to track their points.
Changes Made
1. Public Member Portal (CODE_BLOCK_0)
A complete front-end interface has been added for members, accessible via a new Điểm thưởng tab in the main navigation menu.
- Dashboard (CODE_BLOCK_0): Shows the user's current point balance with a large highlight. Also displays their detailed All-Time and Current Month statistics (Threads, Replies, Attachment Uploads/Downloads, SC Articles).
- Transaction Logs (CODE_BLOCK_0): A detailed, paginated table showing the user's historical point changes (Date, Amount, Action, Note, Balance After).
- Top Users Leaderboard (CODE_BLOCK_0): A visually distinct Top 20 leaderboard displaying the top earners.
- Smart Default: Automatically defaults to showing the leaderboard for the month of CODE_BLOCK_0 (ensuring that in the first week of a new month, it still shows last month's finalized results).
- Users can filter to view past months or "All-Time" rankings using a dropdown form.
2. Top Users Widget
- Widget Definition: Added CODE_BLOCK_0 which admins can easily drag and drop into any sidebar via XenForo's Widget manager.
- Features:
- Displays user avatar, linked username, and points.
- Highlights Top 3 users with gold/silver/bronze ranks (#1, #2, #3).
- Admins can configure the number of users to show (e.g. 5, 10) and whether it displays the current month's ranking (using the smart CODE_BLOCK_0 logic) or All-Time ranking.
3. Real-time Points & Statistics (replaces Cron)
Removed: CODE_BLOCK_0 — the hourly cron is no longer needed.
Modified: Post.php (complete rewrite)
- Tracks CODE_BLOCK_0 transitions via CODE_BLOCK_1:
- Insert as CODE_BLOCK_0 → award points + update stats immediately
- Insert as CODE_BLOCK_0 → no points (wait for approval)
- CODE_BLOCK_0 → CODE_BLOCK_1 (approval) → award points + stats
- CODE_BLOCK_0 → CODE_BLOCK_1 → reverse points + stats (using original log amounts)
- CODE_BLOCK_0 → CODE_BLOCK_1 (undelete) → re-award points + stats
Fixed Logic Bugs (Deep Audit):
- Net-Sum Award Tracking: Fixed an issue where restoring a deleted post would permanently fail to re-award points because the system thought it was "already awarded". The CODE_BLOCK_0 logic now accurately tracks net balances (CODE_BLOCK_1) to allow infinite delete/restore toggling without losing points.
- Stat Reversals: Fixed an issue where deleting a thread in a Document Forum would fail to decrement the user's CODE_BLOCK_0 and CODE_BLOCK_1 stats.
Modified: PointManager.php
- Added CODE_BLOCK_0 — atomically increments/decrements stat fields for the current month AND all-time (year=0, month=0) using CODE_BLOCK_1.
4. Document Forums & SC Forums
New options: CODE_BLOCK_0 and CODE_BLOCK_1 — multi-select forum choosers in Admin CP.
New: CreatorService.php
- Overrides CODE_BLOCK_0 to block thread creation in Document Forums unless a non-image attachment (type_grouping = CODE_BLOCK_1) is present.
5. Group Attachment Requirements
New permissions:
- CODE_BLOCK_0 (flag) — If enabled for a user group, thread creation only earns points/stats if a non-image file is attached.
- CODE_BLOCK_0 (flag) — Same for replies.
6. Per-Forum Download Cost
Modified: ForumPointCost.php — CODE_BLOCK_0 changed from CODE_BLOCK_1 to CODE_BLOCK_2 with default CODE_BLOCK_3.
New: Forum.php (extension)
- Adds CODE_BLOCK_0 relation and CODE_BLOCK_1 helper.
New: Admin/Controller/Forum.php (extension)
- Saves CODE_BLOCK_0 input via CODE_BLOCK_1 override.
New template modification: CODE_BLOCK_0 (admin) — adds a numberbox for download cost inside the "Advanced options" section of CODE_BLOCK_1.
7. Database Migration
[Setup.php](file:///e:/xampp/htdocs/xen/src/addons/VNXF/PointManager/Setup.php):
- CODE_BLOCK_0 — ALTER TABLE CODE_BLOCK_1 to change CODE_BLOCK_2 from UNSIGNED INT to signed INT with DEFAULT -1.
Validation
- ✅ Import thành công (82 phrases, 6 extensions, 8 options, 6 permissions, 3 admin template mods, 4 public templates, 1 widget definition, 1 public route, 1 public navigation)
- ✅ Build release CODE_BLOCK_0 thành công
