Search by

considbrs-webdev / revisionary-municipio-frontend

michaelclaesson

Simplified front-end experience for the revisor role (Revisionary) on Municipio/Modularity sites: suggest-changes button, per-module pencils and return-to-page after submitting.

Package info

github.com/Considbrs-Webdev/revisionary-municipio-frontend

Type:wordpress-plugin

pkg:composer/considbrs-webdev/revisionary-municipio-frontend

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.4.1 2026-11-29 18:59 UTC

This package is auto-updated.

Last update: 2026-11-29 18:59:25 UTC


README

A WordPress plugin that gives the revisor role (Revisionary) a simplified front-end experience on Municipio/Modularity sites. Revisors can suggest changes to pages and modules without ever publishing anything themselves.

What it does (for users with the revisor role only)

  • Hides the WordPress admin bar on the front end.
  • Floating button group in the bottom-right corner:
    • Lämna förslag på ändringar ("Suggest changes") – leads to Revisionary's create-revision route for the current page/post. If the user already has an unsent revision, the button goes straight to it ("Fortsätt på ditt förslag"). Only shown for post types where revisions are enabled.
    • Logga ut ("Log out") – with a confirmation prompt.
  • A pencil in the top-right corner of every Modularity module attached to the current page, with a tooltip (module type and name) and an outlined module area on hover. The other pencils are hidden while one is hovered. Pencils are added client-side because Modularity fragment-caches module HTML.
  • A yellow notice at the top of the page when the page has modules that are edited separately.
  • After login: the front page or the page the user came from (never wp-admin).
  • In wp-admin: hides the top bar, the side menu and a configurable set of metaboxes.

Source strings are in English; a Swedish translation (sv_SE) is included in languages/. The text domain is revisionary-municipio-frontend, the same as the plugin slug and the package name. Regenerate the template with xgettext and compile the .mo file with msgfmt after changing any strings.

Capabilities

edit_modules and edit_other_modules are granted in memory (user_has_cap, nothing is written to the database) only:

  • on the front end,
  • in the create-revision request in admin, and
  • when editing the revisor's own unpublished revision.

edit_published_* is never granted, so a revisor cannot approve their own revisions.

Structure

PSR-4 autoloaded (WpmuRevisorFrontend\ → src/). Composer's vendor/autoload.php is used if present, otherwise a small fallback autoloader in the main file. Each feature is a class with a register() method that adds its hooks; Plugin::boot() registers them all.

Class Responsibility
Support\Revisor The revisor role check
Support\Capabilities In-memory module capabilities, reuse of unsent revisions
Revisions\RevisionFinder Own draft / pending revisions, create-revision target URL
Admin\AdminChrome Hides admin bar, menu and metaboxes; "back to the page" bar
Admin\EditorGuidance Plain-language notice, labels and preview link on the revision edit screen
Auth\LoginRedirect Redirect after login
Frontend\FloatingButtons Suggest / pending status / log out buttons
Frontend\UnsentChangesBar Yellow bar on pages where the revisor has an unsent draft
Frontend\ModulePencils Per-module pencils and their URL endpoint
Navigation\SubmitReturn Return page cookie, redirect and banner after submitting

Composer

Package: considbrs-webdev/revisionary-municipio-frontend (type wordpress-plugin, MIT). It requires Revisionary through WPackagist (wpackagist-plugin/revisionary). Composer ignores repositories declared by dependencies, so the consuming project must provide the WPackagist repository itself, and composer/installers must map type:wordpress-plugin to wp-content/plugins/{$name} (Municipio deployments already do both).

Add it to the site's composer.local.json (or composer.json):

{
  "require": {
    "considbrs-webdev/revisionary-municipio-frontend": "^1.0"
  }
}

Until the package is registered on Packagist, add the repository as a VCS source:

"repositories": [
  { "type": "vcs", "url": "https://github.com/Considbrs-Webdev/revisionary-municipio-frontend" }
]

The package installs into wp-content/plugins/revisionary-municipio-frontend/ (extra.installer-name) and must then be activated (per site, or network-activated on multisite). WordPress 6.5+ requires Revisionary to be active first (Requires Plugins header). Modularity (Municipio) is not on WPackagist and must be installed separately.

Installation

Via Composer (see above), or place the folder in wp-content/plugins/revisionary-municipio-frontend/ and activate it. Revisionary and Modularity must be active.

Filters

All filters are prefixed with revisionary_modularity_.

Filter Arguments Description
revisionary_modularity_hidden_metaboxes string[] $ids Element IDs of metaboxes hidden for revisors in wp-admin (e.g. acf-group_64227d79a7f57, modularity-usage). Invalid ID characters are stripped.
revisionary_modularity_show_module_pencil bool $show, WP_Post $module, array $target, int $postId Return false to not show the pencil on a module (e.g. mod-spacer). $target is ['url' => string, 'existing' => bool].
revisionary_modularity_show_suggest_button bool $show, WP_Post $post, array $target Return false to hide the "suggest changes" button for a post.
revisionary_modularity_login_redirect string $url, WP_User $user, string $requestedRedirectTo Where the revisor is sent after login (default: the front page or the page the user came from).

Examples

// Hide the pencil on spacers and scripts.
add_filter('revisionary_modularity_show_module_pencil', function ($show, $module) {
    return in_array($module->post_type, ['mod-spacer', 'mod-script'], true) ? false : $show;
}, 10, 2);

// Hide an additional metabox.
add_filter('revisionary_modularity_hidden_metaboxes', function (array $ids) {
    $ids[] = 'acf-group_67065157310c7'; // List settings
    return $ids;
});

Roadmap

See ROADMAP.md.