(Disable links)
Line 1: Line 1:
 
This is a list of tips and tricks I use on various [[WikiMedia]] that I run.
 
This is a list of tips and tricks I use on various [[WikiMedia]] that I run.
  
Unless noted, this applies to the <tt>1.15.1 – 2009-07-13</tt> version.
+
Various versions, such as 1.15.1 for <tt>1.15.1 – 2009-07-13</tt>, may appear.
  
 
= Disable links =
 
= Disable links =
  
On [[Laussywiki]], you can't follow a red-link (that refers to a page that still does not exist), unless you're Elena or myself. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.
+
On [[Laussywiki]], you can't follow a red-link (that refers to a page that still does not exist), unless you're [[Elena]] or [[Fabrice|myself]]. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.
  
This is achieved by patching ''Linker.php'', c. Line 287:
+
This is achieved by patching ''Linker.php'':
 +
 
 +
== 1.16.0 ==
 +
 
 +
Line 285:
 +
 
 +
<pre>
 +
# Get a default title attribute.
 +
if( $target->getPrefixedText() == '' ) {
 +
# A link like [[#Foo]].  This used to mean an empty title
 +
# attribute, but that's silly.  Just don't output a title.
 +
} elseif( in_array( 'known', $options ) ) {
 +
$defaults['title'] = $target->getPrefixedText();
 +
} else {
 +
$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 +
if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
 +
}
 +
</pre>
 +
 
 +
== 1.15.1 ==
 +
 
 +
Line 287:
  
 
<pre>
 
<pre>
Line 15: Line 36:
 
} else {
 
} else {
 
  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 
  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
  if ( $wgUser->isLoggedIn() ) { $defaults['onclick'] = "return false;"; }
+
  if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
 
}
 
}
 
</pre>
 
</pre>
  
We added the line that adds <pre>onclick="return false;"</pre> to the <tt>a</tt> tag, which prevents unlogged users to go further.
+
We added the line that puts <pre>onclick="return false;"</pre> to the <tt>a</tt> tag, which prevents unlogged users to go further.

Revision as of 10:11, 3 November 2010

This is a list of tips and tricks I use on various WikiMedia that I run.

Various versions, such as 1.15.1 for 1.15.1 – 2009-07-13, may appear.

Disable links

On Laussywiki, you can't follow a red-link (that refers to a page that still does not exist), unless you're Elena or myself. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.

This is achieved by patching Linker.php:

1.16.0

Line 285:

		# Get a default title attribute.
		if( $target->getPrefixedText() == '' ) {
			# A link like [[#Foo]].  This used to mean an empty title
			# attribute, but that's silly.  Just don't output a title.
		} elseif( in_array( 'known', $options ) ) {
			$defaults['title'] = $target->getPrefixedText();
		} else {
			$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
			if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
		}

1.15.1

Line 287:

		# Get a default title attribute.
		if( in_array( 'known', $options ) ) {
			$defaults['title'] = $target->getPrefixedText();
		} else {
		  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
		  if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
		}
We added the line that puts
onclick="return false;"
to the a tag, which prevents unlogged users to go further.