showLogExtract of block log on user (talk) pages of blocked users
authorTobias <churchofemacs@users.mediawiki.org>
Wed, 10 Feb 2010 13:08:24 +0000 (13:08 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Wed, 10 Feb 2010 13:08:24 +0000 (13:08 +0000)
includes/Article.php
includes/EditPage.php

index f575df1..f7b126d 100644 (file)
@@ -1208,7 +1208,7 @@ class Article {
        public function showMissingArticle() {
                global $wgOut, $wgRequest, $wgUser;
 
-               # Show info in user (talk) namespace. Does the user exist?
+               # Show info in user (talk) namespace. Does the user exist? Is he blocked?
                if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
                        $parts = explode( '/', $this->mTitle->getText() );
                        $rootPart = $parts[0];
@@ -1217,6 +1217,21 @@ class Article {
                        if ( $id == 0 && !$ip ) { # User does not exist
                                $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1</div>",
                                        array( 'userpage-userdoesnotexist-view', $rootPart ) );
+                       } else if (User::newFromId($id)->isBlocked()) { # Show log extract if the user is currently blocked
+                               LogEventsList::showLogExtract(
+                                       $wgOut,
+                                       'block',
+                                       $this->mTitle->getSubjectPage()->getPrefixedText(),
+                                       '',
+                                       array(
+                                               'lim' => 1,
+                                               'showIfEmpty' => false,
+                                               'msgKey' => array(
+                                                       'sp-contributions-blocked-notice',
+                                                       $this->mTitle->getSubjectPage()->getPrefixedText() # Support GENDER in notice
+                                               )
+                                       )
+                               );
                        }
                }
                wfRunHooks( 'ShowMissingArticle', array( $this ) );
index 224764f..657c46e 100644 (file)
@@ -765,15 +765,31 @@ class EditPage {
                        $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1</div>", 'editinginterface' );
                }
 
-               # Show a warning message when someone creates/edits a user (talk) page but the user does not exists
+               # Show a warning message when someone creates/edits a user (talk) page but the user does not exist
+               # Show log extract when the user is currently blocked
                if ( $namespace == NS_USER || $namespace == NS_USER_TALK ) {
                        $parts = explode( '/', $this->mTitle->getText(), 2 );
                        $username = $parts[0];
                        $id = User::idFromName( $username );
                        $ip = User::isIP( $username );
-                       if ( $id == 0 && !$ip ) {
+                       if ( $id == 0 && !$ip ) { # User does not exist
                                $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1</div>",
                                        array( 'userpage-userdoesnotexist', $username ) );
+                       } else if (User::newFromId($id)->isBlocked()) { # Show log extract if the user is currently blocked
+                               LogEventsList::showLogExtract(
+                                       $wgOut,
+                                       'block',
+                                       $this->mTitle->getSubjectPage()->getPrefixedText(),
+                                       '',
+                                       array(
+                                               'lim' => 1,
+                                               'showIfEmpty' => false,
+                                               'msgKey' => array(
+                                                       'sp-contributions-blocked-notice',
+                                                       $this->mTitle->getSubjectPage()->getPrefixedText() # Support GENDER in notice
+                                               )
+                                       )
+                               );
                        }
                }
                # Try to add a custom edit intro, or use the standard one if this is not possible.