Jump to content

Wikia code/includes/specials/SpecialSpecialpages.php

From mediawiki.org

This seems like a pretty good idea... would recommend merging this whole $wgSpecialPagesRequiredLogin (& redirecting to login) system to core.

--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\specials\SpecialSpecialpages.php	2011-07-18 22:31:17.680664100 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\specials\SpecialSpecialpages.php	2011-08-17 15:28:16.327148400 +0100
@@ -8,7 +8,7 @@
  *
  */
 function wfSpecialSpecialpages() {
-	global $wgOut, $wgUser, $wgMessageCache, $wgSortSpecialPages;
+	global $wgOut, $wgUser, $wgMessageCache, $wgSortSpecialPages, $wgSpecialPagesRequiredLogin;
 
 	$wgMessageCache->loadAllMessages();
 
@@ -61,7 +61,14 @@
 		$wgOut->addHTML( "<td width='30%' valign='top'><ul>\n" );
 		foreach( $sortedPages as $desc => $specialpage ) {
 			list( $title, $restricted ) = $specialpage;
+			/* Wikia change begin - @author: Marooned */
+			/* Redirect to login page instead of showing error, see Login friction project */
+			if ($wgUser->isAnon() && in_array(SpecialPage::resolveAlias($title->getDBkey()), $wgSpecialPagesRequiredLogin)) {
+				$link = $sk->makeKnownLinkObj( Title::makeTitle(NS_SPECIAL, 'Signup') , htmlspecialchars( $desc ), wfGetReturntoParam($title->getPrefixedDBkey()) );
+			} else {
 			$link = $sk->linkKnown( $title , htmlspecialchars( $desc ) );
+			}
+			/* Wikia change end */
 			if( $restricted ) {
 				$includesRestrictedPages = true;
 				$wgOut->addHTML( "<li class='mw-specialpages-page mw-specialpagerestricted'><strong>{$link}</strong></li>\n" );