shebaoting/flarum-repost 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

shebaoting/flarum-repost

Composer 安装命令:

composer require shebaoting/flarum-repost

包简介

A Flarum extension that redirects to the original URL if specified when posting.

关键字:

README 文档

README

License Latest Stable Version Total Downloads

Repost is a Flarum 2.x extension for publishing link-based discussions. If a new discussion starts with an HTTP or HTTPS URL, the extension stores that URL as the discussion's original source and turns the discussion list title into an external link. The local discussion page remains available, so community members can still reply, moderate, and discuss the linked content inside Flarum.

中文介绍

Features

  • Detects URLs at the beginning of new discussion content.
  • Stores the detected URL on the discussion as originalUrl.
  • Shows the source domain in the discussion list metadata.
  • Opens the original source URL when users click the discussion title/list main area.
  • Keeps the reply/comment count linked to the local Flarum discussion page.
  • Displays a notice on the discussion page to show that the topic is a reposted source.
  • Adds an admin permission for controlling who can extract and save original URLs.
  • Supports existing 1.x data stored in the discussions.original_url column.
  • Ships English and Chinese translation files.

Requirements

  • Flarum ^2.0.0-beta
  • PHP ^8.3

This extension is intended for Flarum 2.x. Use the v0.x series for old Flarum 1.x installations.

Installation

Install the extension with Composer:

composer require shebaoting/flarum-repost:"^2.0"
php flarum migrate
php flarum cache:clear

If you are using a local path repository during development, require the same 2.x constraint from your Flarum app:

composer require shebaoting/flarum-repost:"^2.0" -W
php flarum migrate
php flarum cache:clear

Updating

composer update shebaoting/flarum-repost -W
php flarum migrate
php flarum cache:clear

If your forum still requires the old package name, switch the Composer requirement first:

composer remove shebaoting/repost --no-update
composer require shebaoting/flarum-repost:"^2.0" -W

After clearing the cache, refresh the forum page in the browser so Flarum regenerates the combined frontend assets.

Configuration

Go to Admin > Permissions and configure the Repost permission:

  • Extract original URL: users with this permission can create discussions whose first line starts with a URL and have that URL saved as the discussion's original source.

Users without this permission can still create normal discussions, but the extension will not save an originalUrl value for them.

Usage

Create a discussion whose content starts with a full URL:

https://example.com/article

This is a short note about why this article is worth discussing.

When the discussion is published:

  1. The URL is stored as the discussion's original source.
  2. The discussion list shows the source domain, for example example.com.
  3. Clicking the discussion title opens the original source in a new tab.
  4. Clicking the reply/comment icon or number opens the local Flarum discussion page.
  5. Replies, moderation actions, tags, subscriptions, and other Flarum discussion features continue to work on the local page.

Behavior Details

Only URLs that appear at the very beginning of the discussion content are extracted. The URL must start with http:// or https://.

The extension does not fetch, scrape, or copy the remote page. It only stores the source URL and adjusts the discussion list link behavior.

The local discussion URL remains the canonical place for comments. This is useful for RSS imports, news sharing, bookmarks, link roundups, and communities where users want to discuss external content without duplicating the full article.

Data And Migration Notes

Repost stores the original source URL in the discussions.original_url column.

For Flarum 1.x upgrades, existing values in this column are preserved. The migration is idempotent and will not recreate the column if it already exists.

Development

Install JavaScript dependencies and build the frontend assets:

cd js
corepack yarn install
corepack yarn build

Useful checks:

composer validate --no-check-publish
find . -path './vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 php -l

Troubleshooting

If the discussion list still links every part of a reposted discussion to the external source, clear Flarum's cache and refresh the forum:

php flarum cache:clear

If the original URL is not saved, check that the actor has the Extract original URL permission and that the discussion content begins directly with an http:// or https:// URL.

Links

License

This extension is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固