Jump to content

ICT:Hooks ClutterReduction

From Costa Sano MediaWiki

ICT:Hooks/ClutterReduction

This page documents the custom MediaWiki hooks used in LocalSettings.php to reduce interface clutter for clubmembers. The goal is to present a calm, application‑like interface while preserving full functionality for sysops.

These hooks are skin‑agnostic and work with Vector‑2022 or any other skin.


1. Sidebar Control (SkinBuildSidebar)

Purpose

Clubmembers do not need the standard MediaWiki sidebar (Tools, Special pages, Help, etc.). This hook replaces the sidebar depending on the user’s role:

  • **Anonymous users** → no sidebar
  • **Clubmembers** → only a single “Dashboard” link
  • **Sysops** → full sidebar (default behavior)

This prevents non‑technical users from wandering into system areas and keeps the UI focused on the archive.

Code

$wgHooks['SkinBuildSidebar'][] = function ( $skin, &$bar ) {
    $user = $skin->getUser();

    # Anonymous: hide everything
    if ( $user->isAnon() ) {
        $bar = [];
        return true;
    }

    # Clubmembers: show only Dashboard
    if ( $user->isAllowed( 'edit' ) && !$user->isAllowed( 'editinterface' ) ) {
        $bar = [
            'navigation' => [
                [
                    'text' => 'Dashboard',
                    'href' => '/wiki/Dashboard:Home'
                ]
            ]
        ];
        return true;
    }

    # Sysops: full sidebar
    return true;
};

Why this hook exists

  • The standard sidebar exposes too many technical links.
  • Clubmembers only need one entry point into the archive.
  • The hook is reversible and easy for successors to understand.
  • No skin modifications or CSS hacks required.

2. Action Tabs Control (SkinTemplateNavigation::Universal)

Purpose

On system namespaces (Template, Module, MediaWiki, Category, Form, etc.), clubmembers should not see:

  • Edit
  • View source
  • History
  • Move
  • Delete

These actions are confusing and potentially dangerous for non‑technical users. Sysops retain full access.

Code

$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $skin, &$links ) {

    $user = $skin->getUser();
    if ( $user->isAllowed( 'editinterface' ) ) {
        return true; # sysop sees everything
    }

    $title = $skin->getTitle();
    if ( !$title ) return true;

    $ns = $title->getNamespace();

    # System namespaces to hide tabs for
    $blocked = [
        NS_MEDIAWIKI,
        NS_TEMPLATE,
        NS_MODULE,
        NS_HELP,
        NS_PROJECT,
        NS_CATEGORY,
        defined('PF_NS_FORM') ? PF_NS_FORM : null,
    ];

    if ( in_array( $ns, $blocked, true ) ) {

        # Remove edit/viewsource/history tabs
        unset( $links['views']['edit'] );
        unset( $links['views']['viewsource'] );
        unset( $links['views']['history'] );

        # Remove actions like move/delete
        unset( $links['actions']['delete'] );
        unset( $links['actions']['move'] );
    }

    return true;
};

Why this hook exists

  • Clubmembers should not modify system pages.
  • Removing these tabs prevents accidental edits or confusion.
  • Only system namespaces are affected — content pages remain editable.
  • Keeps the interface calm and focused on the archive.

3. Design Philosophy

These hooks implement the long‑term UI principles for the archive:

Calm, application‑like interface

Clubmembers see only what they need — no clutter, no technical distractions.

Role‑based clarity

Sysops retain full control; clubmembers get a simplified experience.

Successor‑friendly

Hooks are documented, reversible, and do not modify core files or skins.

Skin‑agnostic

Works with Vector‑2022 today and any future skin if the system evolves.


This page is part of the ICT documentation set for the archive infrastructure.