Extension:HideEditOnPreview

From MediaWiki.org
Jump to navigation Jump to search

MediaWiki extensions manual
Crystal Clear action run.svg
HideEditOnPreview
Release status: stable
Implementation Page action
Description Hides the edit-link (tab) in preview mode
Author(s) Hendrik Brummermanntalk
Latest version 1.1
License CC BY, GPL
Download see below
Translate the HideEditOnPreview extension if it is available at translatewiki.net
Check usage and version matrix.

This extension hides the edit-link on the edit page. Some user tend to click it to return from the preview page to the edit window instead of scrolling down. Unfortunatally this causes their edits to be lost. So this extensions hides that link.

Installation[edit]

  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/HideEditOnPreview/HideEditOnPreview.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Source code[edit]

<?php
/**
 * Hides the edit-link (tab) in preview mode because user click on it to return
 * to the edit box. It will, however, reload the edit box destroying all unsaved
 * changes.
 *
 * Installation: Copy HideEditOnPreview.php to your extension folder and add
 * require_once($IP."/extensions/HideEditOnPreview.php");
 * to your LocalSettings.php
 *
 * @author Hendrik Brummermann
 * @version 1.1
 */

$wgHooks['SkinTemplateContentActions'][] = 'hideEditOnPreview';

function hideEditOnPreview($actions) {

        global $wgRequest;

        if ( $wgRequest->getVal('action') == 'submit' ) {
                unset($actions['edit']);
        }
        return true;
}

$wgExtensionCredits['other'][] = array(
        'name' => 'HideEditOnPreview',
        'version' => '1.1',
        'author' => 'Hendrik Brummermann',
        'url' => 'http://mediawiki.org/wiki/Extension:HideEditOnPreview',
        'description' => 'Hides the edit-link (tab) in preview mode'
);

?>