Index: trunk/phase3/includes/Linker.php |
— | — | @@ -918,16 +918,23 @@ |
919 | 919 | /** |
920 | 920 | * Make user link (or user contributions for unregistered users) |
921 | 921 | * @param $userId Integer: user id in database. |
922 | | - * @param $userText String: user name in database |
| 922 | + * @param $userName String: user name in database. |
| 923 | + * @param $altUserName String: text to display instead of the user name (optional) |
923 | 924 | * @return String: HTML fragment |
| 925 | + * @since 1.19 Method exists for a long time. $displayText was added in 1.19. |
924 | 926 | */ |
925 | | - public static function userLink( $userId, $userText ) { |
| 927 | + public static function userLink( $userId, $userName, $altUserName = false ) { |
926 | 928 | if ( $userId == 0 ) { |
927 | | - $page = SpecialPage::getTitleFor( 'Contributions', $userText ); |
| 929 | + $page = SpecialPage::getTitleFor( 'Contributions', $userName ); |
928 | 930 | } else { |
929 | | - $page = Title::makeTitle( NS_USER, $userText ); |
| 931 | + $page = Title::makeTitle( NS_USER, $userName ); |
930 | 932 | } |
931 | | - return self::link( $page, htmlspecialchars( $userText ), array( 'class' => 'mw-userlink' ) ); |
| 933 | + |
| 934 | + return self::link( |
| 935 | + $page, |
| 936 | + htmlspecialchars( $altUserName !== false ? $altUserName : $userName ), |
| 937 | + array( 'class' => 'mw-userlink' ) |
| 938 | + ); |
932 | 939 | } |
933 | 940 | |
934 | 941 | /** |