PHPackages                             tryhackx/flarum-advanced-pages - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. tryhackx/flarum-advanced-pages

ActiveFlarum-extension[Authentication &amp; Authorization](/categories/authentication)

tryhackx/flarum-advanced-pages
==============================

Create advanced custom pages with HTML, BBCode, Markdown, PHP, or plain text, featuring nested hierarchies, breadcrumbs, and granular console-managed permissions for Flarum 2.x.

2.2.0(2w ago)23651MITJavaScriptPHP ^8.2

Since Apr 12Pushed 1w agoCompare

[ Source](https://github.com/TryHackX/flarum-advanced-pages)[ Packagist](https://packagist.org/packages/tryhackx/flarum-advanced-pages)[ RSS](/packages/tryhackx-flarum-advanced-pages/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (9)Used By (0)

Advanced Pages for Flarum
=========================

[](#advanced-pages-for-flarum)

[![Flarum 2.x](https://camo.githubusercontent.com/c685ab9c582b67982fccb9534f2b35cd8de7ee1a6ae2540336c763ce9d4c0e83/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f466c6172756d2d322e782d6f72616e6765)](https://flarum.org)[![Packagist](https://camo.githubusercontent.com/e3c969ccfeae744f7d573527ee45395fcc29ae5b015f689b90c74e4e997e3fdb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7472796861636b782f666c6172756d2d616476616e6365642d7061676573)](https://packagist.org/packages/tryhackx/flarum-advanced-pages)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Create advanced custom pages with **HTML**, **BBCode**, **Markdown**, **PHP**, or **plain text** content types for your Flarum 2.x forum. A powerful alternative to `fof/pages` with multi-format support, live preview, formatting toolbars, and granular access control.

> **Latest highlights (2.1.0):**
>
> - **Nested / child pages** with a *Parent Page* selector, **drag-and-drop**ordering &amp; nesting in the admin (grab the `⋮⋮` handle), parent-chain breadcrumbs, and optional **per-tree breadcrumb CSS** (style or hide them).
> - **Per-content-type creation permissions** — control who can create Plain Text / BBCode / Markdown pages from the admin grid, and who can create the sensitive **HTML** / **PHP** pages via a dedicated console command (`php flarum advancedpages:permission`).
> - **Per-page "Allow script execution" toggle** — `` tags in a page now run only when you explicitly opt in (off by default).
> - **Cross-database visibility** — per-group visibility now works on SQLite and PostgreSQL too, not just MySQL/MariaDB.
> - `$actor` now works inside PHP pages.

> **Note:** Advanced Pages targets the **2.x** line only (Flarum 2.x).

Features
--------

[](#features)

- **5 content types** — HTML (rendered raw — admin/permission-gated), BBCode, Markdown, PHP (server-side, admin/permission-gated), Plain Text.
- **Nested pages** — parent/child hierarchy with slash-based URLs and breadcrumbs.
- **Formatting toolbars** — context-aware buttons for the BBCode and Markdown editors.
- **Live preview** — Raw / Preview toggle with syntax highlighting (highlight.js One Dark).
- **Code editor** — CodeMirror-powered editor for HTML and PHP with syntax highlighting.
- **Code blocks** — rendered code gets *Select* / *Copy* buttons and a capped, scrollable height; the toolbar can optionally be added to regular forum posts too (admin setting).
- **BBCode extensions** — `[table]`, `[spoiler]`, `[center]`, extended `[url]` parser (configurable).
- **Newline modes** — Flarum vanilla or *preserve-all* for BBCode pages.
- **Spoiler system** — `[spoiler]` / `[spoiler=Title]` with permission-based visibility (`advancedPages.viewSpoilers`, default Members).
- **Admin panel** — full CRUD with pagination, per-page selector, inline settings, *Save Changes* + *Reset Settings* buttons (Reset opens Flarum core's `ResetExtensionSettingsModal` populated with this extension's settings).
- **SEO support** — meta descriptions and proper `` tags.
- **Access control** — publish, hide (admin-only), restrict (login-required), per-group visibility (works on MySQL/MariaDB, SQLite 3.38+ and PostgreSQL).
- **Granular permissions** — manage pages, view spoiler content, and per-content-type page creation (text/BBCode/Markdown in the admin grid; HTML/PHP via console command).
- **Clean URLs** — pages live at `/p/{slug}`, including nested paths like `/p/docs/getting-started`.

Screenshots
-----------

[](#screenshots)

[![Mobile view of the discussion list across multiple TryHackX layout combinations](assets/ALL_MOBILE.png)](assets/ALL_MOBILE.png)

*Mobile view — discussion list rendered with different combinations of TryHackX extensions (thumbnails + ratings + views, thumbnails + views, thumbnails only, ratings only, views only, vanilla Flarum).*

[![Advanced Pages admin settings — page list, BBCode toggles, forum integration and permissions](assets/Advanced_Pages.png)](assets/Advanced_Pages.png)

*Advanced Pages admin panel — page management, BBCode tag toggles (`[table]`, `[spoiler]`, `[center]`, extended `[url]`), forum spoiler replacement and the *Save Changes* / *Reset Settings* row, plus the *Manage Advanced Pages* and *View spoiler content* permissions.*

[![Desktop discussion list with the full TryHackX stack — thumbnail sliders, star ratings and the magnet button](assets/ALL_VIA_MAGNETS.png)](assets/ALL_VIA_MAGNETS.png)

*Desktop discussion list with the full TryHackX stack — thumbnail sliders on the left, star ratings on the right, magnet button next to each topic.*

[![Desktop discussion list — magnet tooltip mid-load on a topic](assets/ALL_VIA_MAGNETS_v2.png)](assets/ALL_VIA_MAGNETS_v2.png)

*Desktop discussion list — hover state showing the magnet tooltip loading inline (powered by `tryhackx/flarum-magnet-link`).*

Support Development
-------------------

[](#support-development)

If you find this extension useful, consider supporting its development:

- **Monero (XMR):** `45hvee4Jv7qeAm6SrBzXb9YVjb8DkHtFtFh7qkDMxS9zYX3NRi1dV27MtSdVC5X8T1YVoiG8XFiJkh4p9UncqWGxHi4tiwk`
- **Bitcoin (BTC):** `bc1qncavcek4kknpvykedxas8kxash9kdng990qed2`
- **Ethereum (ETH):** `0xa3d38d5Cf202598dd782C611e9F43f342C967cF5`

You can also find the donation option in the extension's admin settings panel.

Requirements
------------

[](#requirements)

- **Flarum** `^2.0`
- **PHP** `^8.2`
- **PHP memory\_limit** `256M` minimum (512M+ recommended — see *Memory* below).

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

[](#installation)

```
composer require tryhackx/flarum-advanced-pages
php flarum migrate
php flarum cache:clear
```

Updating
--------

[](#updating)

```
composer update tryhackx/flarum-advanced-pages
php flarum migrate
php flarum cache:clear
```

Usage
-----

[](#usage)

### Creating pages

[](#creating-pages)

1. Go to **Admin Panel → Advanced Pages**.
2. Click **Create Page**.
3. Choose a content type and write your content.
4. Configure visibility (published, hidden, restricted, group access).
5. Save — the page is available at `/p/{your-slug}`.

### Content types

[](#content-types)

TypeDescriptionSecurity**HTML**Full HTML with styles / forms / (opt-in) scripts**Rendered raw, NOT sanitised.** Creation gated by `advancedPages.create.html` (console-only). `` runs only if *Allow script execution* is enabled per page.**BBCode**BBCode with custom tags &amp; toolbarEscaped and parsed via s9e/TextFormatter**Markdown**Full Markdown with live previewEscaped and parsed via s9e/TextFormatter**PHP**Server-side PHP execution (`eval`)**Full server privileges** — not a real sandbox. Creation gated by `advancedPages.create.php` (console-only). Errors logged, never shown.**Plain Text**Auto-escaped text with URL linkingFully escaped output### BBCode toggles

[](#bbcode-toggles)

SettingTagsDefaultTables`[table]` `[tr]` `[th]` `[td]`OnSpoiler`[spoiler]` `[spoiler=Title]`OnCenter`[center]`OnExtended URL`[url]` (accepts URLs Flarum rejects)Off**Replace Forum Spoiler**swap Flarum's default `[spoiler]` for the Advanced Pages `details/summary` style across all postsOff**Code buttons in posts**add the *Select* / *Copy* code-block toolbar to regular forum posts (it's always on for Advanced Pages)OffAfter toggling BBCode settings, clear the formatter cache:

```
php flarum cache:clear
```

### Newline mode (BBCode)

[](#newline-mode-bbcode)

Per-page newline behaviour:

- **Flarum** *(default)* — multiple newlines collapse to a single break (vanilla Flarum behaviour).
- **Preserve** — every newline is kept as a line break (code blocks keep real newlines, so they still highlight correctly).

### PHP pages

[](#php-pages)

> ⚠️ PHP pages run via `eval()` with **full server privileges**. The closure only scopes the variables below — it is **not** a security sandbox. Treat the ability to create PHP pages as equivalent to shell access. By default only administrators can create them.

PHP page code runs in a closure with access to:

- `$page` — current Page model
- `$actor` — the current user. This is always a `User` object; for guests it is a guest instance (`$actor->isGuest() === true`), not `null`.
- `$settings` — Flarum `SettingsRepository`
- `$csrfToken` — the current session's CSRF token (see *Forms* below)
- `$pages` — read-only page-tree helper for nav menus (see *Building a nav menu* below)
- the usual PHP superglobals: `$_GET`, `$_POST`, `$_FILES`, `$_SERVER`, …

```
Welcome,
Current time:
