- if( is_object( $this->previousResult ) &&
- (is_null( $result ) || ( $this->previousResult->title != $result->title ) ) ) {
- // Different username, give back name(group1,group2)
- $name = $skin->makeLink( $wgContLang->getNsText($this->previousResult->namespace) . ':' . $this->previousResult->title, $this->previousResult->title );
- $name .= $this->concatGroups ? '('.substr($this->concatGroups,0,-1).')' : '';
- $this->clearGroups();
- }
-
- if( is_object( $result ) && $result->type != '') {
- $this->appendGroups( $skin->makeLink( wfMsgForContent( 'administrators' ), $result->type ) );
+ $userPage = Title::makeTitle( $result->namespace, $result->title );
+ $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
+
+ if( !isset( $result->numgroups ) || $result->numgroups > 0 ) {
+ $dbr =& wfGetDB( DB_SLAVE );
+ $result = $dbr->select( 'user_groups',
+ array( 'ug_group' ),
+ array( 'ug_user' => $result->user_id ),
+ 'ListUsersPage::formatResult' );
+ $groups = array();
+ while( $row = $dbr->fetchObject( $result ) ) {
+ $groups[] = User::getGroupName( $row->ug_group );
+ }
+ $dbr->freeResult( $result );
+
+ if( count( $groups ) > 0 ) {
+ $name .= ' (' .
+ $skin->makeLink( wfMsgForContent( 'administrators' ),
+ htmlspecialchars( implode( ', ', $groups ) ) ) .
+ ')';
+ }