定制 resofire/discussion-participants 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

resofire/discussion-participants

最新稳定版本:v2.1.0

Composer 安装命令:

composer require resofire/discussion-participants

包简介

Shows avatars of users who have participated in a discussion.

README 文档

README

Shows an inline avatar strip of the first 6 repliers in each discussion on the Flarum discussion list. A "+N more" badge opens a paginated modal listing all participants.

How it works

Avatar strip

Participant avatars are served from a dedicated discussion_participant_previews table rather than from a live query against posts. This table stores at most 6 rows per discussion — the first 6 repliers by first-post date, with the original poster excluded (Flarum already shows the OP's avatar natively in the discussion list item).

The discussion list query fetches at most 20 discussions × 6 rows = 120 rows, always bounded regardless of how active discussions are.

Preview rows are written at post-event time (Posted, Hidden, Restored, Deleted) — not at read time. This moves cost to writes (rare) rather than reads (every page load).

Overflow badge

The overflow count (+N more) is derived from participantCount, a native Flarum core attribute maintained by DiscussionMetadataUpdater. The formula is simply participantCount - 7: 7 being the OP avatar plus the 6 avatars in the strip. No extra query is needed and the badge only appears once the strip is full.

Live updates

When a user posts for the first time in a discussion, their avatar is appended to the strip immediately in the UI without a page refresh, provided the strip has fewer than 6 entries. The overflow badge also updates instantly via Flarum's own post-save API response.

Paginated modal

The "+N more" button opens a modal that hits a dedicated endpoint (GET /api/discussions/{id}/participants) returning 20 users per page with minimal attributes (id, username, slug, avatarUrl). No full UserSerializer, no single large payload.

Installation

composer require resofire/discussion-participants
php flarum migrate
php flarum cache:clear

Then enable the extension in the Flarum admin panel.

Existing forums (one-time backfill)

For forums with existing discussions, run the backfill command to populate the preview table:

php flarum participants:populate

Alternatively, use the Recalculate button in the extension's admin page, which processes discussions in chunks of 2,000 and displays per-chunk timing and a total elapsed time.

Upgrading from resofire-v2/discussion-participants

  1. Disable the old extension in the admin panel
  2. composer remove resofire-v2/discussion-participants
  3. composer require resofire/discussion-participants
  4. php flarum migrate
  5. php flarum cache:clear
  6. Enable the new extension in the admin panel

Your existing data (discussion_participant_previews table and participant_count column) is preserved — no recalculation needed.

Memory profile

Scenario Without extension With extension
Discussion list (20 discussions) Up to 2,000 User models 120 rows, 6 fields each
Participant data per request ~6 MB ~50 KB
Modal (300 participants) 300 models, ~500 KB JSON 20 models per page, ~4 KB JSON

Requirements

  • Flarum 1.8 or later

resofire/discussion-participants 适用场景与选型建议

resofire/discussion-participants 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 732 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 03 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 resofire/discussion-participants 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 resofire/discussion-participants 我们能提供哪些服务?
定制开发 / 二次开发

基于 resofire/discussion-participants 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 732
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-10