r35470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35469‎ | r35470 | r35471 >
Date:09:02, 28 May 2008
Author:raymond
Status:old
Tags:
Comment:
* Add information about user group membership to Special:Preferences
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -387,6 +387,8 @@
388388 'youremail',
389389 'username',
390390 'uid',
 391+ 'prefs-memberingroups',
 392+ 'prefs-changemembership',
391393 'yourrealname',
392394 'yourlanguage',
393395 'yourvariant',
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -603,10 +603,45 @@
604604 $this->tableRow( Xml::element( 'h2', null, wfMsg( 'prefs-personal' ) ) )
605605 );
606606
 607+ # Get groups to which the user belongs
 608+ $userEffectiveGroups = $wgUser->getEffectiveGroups();
 609+ $userEffectiveGroupsArray = array();
 610+ foreach( $userEffectiveGroups as $ueg ) {
 611+ if( $ueg == '*' ) {
 612+ // Skip the default * group, seems useless here
 613+ continue;
 614+ }
 615+ $msgName = 'group-' . $ueg;
 616+ $groupName = wfMsg( $msgName );
 617+ if( wfEmptyMsg( $msgName, $groupName ) ) {
 618+ // No localized groupname available
 619+ $groupName = $ueg;
 620+ }
 621+ $userEffectiveGroupsArray[] = $groupName;
 622+ }
 623+ asort( $userEffectiveGroupsArray );
 624+
 625+ $sk = $wgUser->getSkin();
 626+ $toolLinks = array();
 627+ $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'ListGroupRights' ), wfMsg( 'listgrouprights' ) );
 628+ if( $wgUser->isAllowed( 'userrights' ) ) {
 629+ $toolLinks[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userrights' ),
 630+ wfMsg( 'prefs-changemembership' ),
 631+ 'user=' . htmlspecialchars( $wgUser->getName() )
 632+ );
 633+ }
 634+
607635 $userInformationHtml =
608636 $this->tableRow( wfMsgHtml( 'username' ), htmlspecialchars( $wgUser->getName() ) ) .
609637 $this->tableRow( wfMsgHtml( 'uid' ), htmlspecialchars( $wgUser->getId() ) ) .
 638+
610639 $this->tableRow(
 640+ wfMsgExt( 'prefs-memberingroups', array( 'parseinline' ), count( $userEffectiveGroupsArray ) ),
 641+ implode( wfMsg( 'comma-separator' ), $userEffectiveGroupsArray ) .
 642+ '<br />(' . implode( ' | ', $toolLinks ) . ')'
 643+ ) .
 644+
 645+ $this->tableRow(
611646 wfMsgHtml( 'prefs-edits' ),
612647 $wgLang->formatNum( User::edits( $wgUser->getId() ) )
613648 );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -872,6 +872,8 @@
873873 'youremail' => 'E-mail:',
874874 'username' => 'Username:',
875875 'uid' => 'User ID:',
 876+'prefs-memberingroups' => 'Member of {{PLURAL:$1|group|groups}}:',
 877+'prefs-changemembership' => 'Change group membership',
876878 'yourrealname' => 'Real name:',
877879 'yourlanguage' => 'Language:',
878880 'yourvariant' => 'Variant:', # only translate this message to other languages if you have to change it
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -557,6 +557,8 @@
558558 'youremail' => 'E-Mail-Adresse:',
559559 'username' => 'Benutzername:',
560560 'uid' => 'Benutzer-ID:',
 561+'prefs-memberingroups' => 'Mitglied der {{PLURAL:$1|Benutzergruppe|Benutzergruppen}}:',
 562+'prefs-changemembership' => 'Benutzerrechte ändern',
561563 'yourrealname' => 'Echter Name:',
562564 'yourlanguage' => 'Sprache der Benutzeroberfläche:',
563565 'yourvariant' => 'Variante',
Index: trunk/phase3/RELEASE-NOTES
@@ -129,6 +129,7 @@
130130 * Sidebar is now cached for all languages
131131 * (bug 14259) Localisation message for upload button on Special:Import is now
132132 'import-upload' instead of 'upload'
 133+* Add information about user group membership to Special:Preferences
133134
134135 === Bug fixes in 1.13 ===
135136

Status & tagging log