peroyomas
peroyomas

Reputation: 823

Disable "red links" on MediaWiki

I want to make the "red links" (links for uncreated pages) on a MediaWiki site to become plain text, save for people logged. Perhaps also make that them don't appear at all or only appear on different situations. You can "hide" them a bit with CSS, but I prefer to actually don't feature them.

Upvotes: 1

Views: 440

Answers (1)

leo
leo

Reputation: 8520

You could use the LinkBegin hook to abort the link creation for page that do not exist. Something like this:

$wgHooks['LinkBegin'][] = 'ExampleExtension::exampleExtensionLinkBegin';

class ExampleExtension {

  public static function exampleExtensionLinkBegin( $dummy, $target, &$html, &$customAttribs, $query, &$options, &$ret ) {

    if ( $target->exists() ) {

      return true;

    } else {

      $ret = $html;
      return false;

    }

  }  //exampleExtensionLinkBegin

}

edit: If you are not familiar with MW extension development, I recommend that you start by reading http://www.mediawiki.org/wiki/Manual:Developing_extensions and http://www.mediawiki.org/wiki/Manual:Hooks

If you know just a little bit of PHP, you should be able to follow that without any problems.

Upvotes: 3

Related Questions