zerosonesfun/flarum-log
Composer 安装命令:
composer require zerosonesfun/flarum-log
包简介
Drink Log: track who's drinking and open a log discussion with one click.
关键字:
README 文档
README
A Flarum extension that adds a Drinking button, tracks who’s drinking (live count + per-user totals), and opens a dated log discussion with an optional Log tag.
- Compatible: Flarum 1.8.x
- Install:
composer require zerosonesfun/flarum-log:"*" - Best experience: Install FoF Direct Links so the composer opens with title, Log tag, and a simple body template already filled in.
Features
- “X Drinking” button (logged-in only): in the sidebar on desktop (under “Start a discussion”), and in the drawer under the search bar on mobile.
Xis the number of users who have clicked in the last 30 minutes (configurable 1–1440). - Cooldown: Each user can add to the live count once per cooldown window; the number goes down as older clicks expire.
- One click does two things:
- Records your “drinking” click (live count + your profile total).
- Opens the new discussion composer with title
Log - MM/DD/YYYYand, when configured, the Log tag. With FoF Direct Links, the composer also opens with a small body template (Date, Time, Location, Amount, Variety).
- Profile total: Each user’s public profile shows their total drinks (e.g. “1 drink” or “1.5k drinks”). It increases when they use the button (after cooldown) or when they manually create a discussion and add the Log tag, and decreases by 1 when they delete one of their own discussions that has the Log tag.
- Profile “Drink Logs” tab: On a user’s profile, a Drink Logs nav item appears under Posts (when Tags is enabled and a Log tag is configured). It shows the number of discussions they’ve created with the Log tag; clicking it loads a list of those discussions.
- Manual Log tag: If someone starts a new discussion and adds the Log tag in the composer (without using the Drinking button), their profile total still increases by 1.
Installation
composer require zerosonesfun/flarum-log:"*"
php flarum migrate
Enable Drink Log in Admin → Extensions.
Recommended: FoF Direct Links (best experience)
For the best experience, install FriendsOfFlarum/direct-links:
composer require fof/direct-links
With Direct Links enabled and a Log tag slug set in Drink Log’s settings, clicking the Drinking button opens the composer via a direct link with:
- Title pre-filled:
Log - DD/MM/YYYY - Primary tag pre-selected: your configured Log tag
- Body pre-filled with a short template:
Date,Time,Location,Amount,Variety
Without Direct Links, the composer still opens in-app with the title set, and the Log tag is attached when you post (for “Log - date” discussions).
Optional: Tags extension and Log tag
If you use flarum/tags:
- Enable the Tags extension.
- In Administration → Tags, create a tag with the slug you set in Drink Log’s Log tag slug (default
log). The extension does not create the tag for you.
New “Log - date” discussions started from the Drinking button get that tag attached automatically. If a user manually adds the Log tag to any new discussion, their profile drink total also increases by 1. This extension never deletes or changes existing tags.
Admin settings
In Administration → Extensions → Drink Log you can set:
- Button label – Text on the button. Use
{count}for the number (e.g.{count} Drinking). - Cooldown (minutes) – Minutes before a user can add to the live count again (1–1440; default 30).
- Log tag slug – Tag slug to attach to “Log - date” discussions and to use with Direct Links. Leave empty to disable auto-tagging and direct-link composer.
Building the frontend (developers)
cd js
npm install
npm run build
This updates js/dist/forum.js and js/dist/admin.js. Commit those files if you ship a pre-built bundle.
Troubleshooting
“Drink Logs” tab doesn’t appear on user profiles
The tab only shows when the forum has a valid Log tag. Check:
- Tags extension is enabled (Administration → Extensions).
- A tag exists whose slug matches Drink Log’s “Log tag slug” (default
log). Create it under Administration → Tags if needed. - Clear Flarum cache so the forum payload includes the tag id:
php flarum cache:clear
Then hard-refresh the forum (Ctrl+F5 / Cmd+Shift+R). - If you installed from source (e.g. git), run
npm run buildin the extension’sjsfolder and deploy the updatedjs/dist/forum.js.
Profile drink total doesn’t decrease when a user deletes a log discussion
The extension now listens for both Deleting (hard delete) and Hidden (soft delete / “delete” in the UI). After updating, hiding or deleting a discussion that has the Log tag will decrement the author’s total. Clear cache and refresh; if it still doesn’t update, confirm the discussion had the Log tag and the Tags extension is enabled.
Security
- Only logged-in users see and can use the Drinking button.
- The “record drink” API requires authentication; cooldown is enforced per user on the backend.
- Profile totals are public; only the count is stored (no extra personal data).
License
MIT.
zerosonesfun/flarum-log 适用场景与选型建议
zerosonesfun/flarum-log 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 39 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「extension」 「flarum」 「drink」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zerosonesfun/flarum-log 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zerosonesfun/flarum-log 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zerosonesfun/flarum-log 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
Adds more BBCode
Output of discussions lists in form of cards
统计信息
- 总下载量: 39
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-07