简体   繁体   中英

How do you edit the HTML for MediaWiki's Special:UserLogin page in MW 1.28?

Previously, there was a class called UserloginTemplate extending BaseTemplate that you were free to copypaste into your own file and use instead in the class loader.

Now, I cannot even find what file this HTML is coming from. I have found includes/specialpage/LoginSignupSpecialPage.php ... but it's Abstract.

abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {

I have no idea where to begin and any information I can find about this is for older versions of MediaWiki.

The process is a little different than before but not too hard.

  1. Create a class for extending the class includes/specials/SpecialUserLogin.php in your extension's directory. I named mine XenForoAuthSpecialUserLogin.php .

  2. In your new class file, extend SpecialUserLogin as you typically would.

    class XenForoAuthSpecialUserLogin extends SpecialUserLogin

    Then, overload the method protected function getPageHtml($formHtml) and return the modified HTML you want.

  3. In your extension's extension.js , add an AutoloadClasses entry for your new class.

  4. In your LocalSettings.php , add this line to replace the special page with your new class.

    $wgSpecialPages['Userlogin'] = [XenForoAuthSpecialUserLogin::class];

    Beware! Although all references use UserLogin , this key (and the page URL) is Userlogin with a lowercase L.

  5. You should now see your changes.

Use the AuthChangeFormFields hook. See the documentation of HTMLForm on what kind of changes you can do. Note that for any change to what kind of data can be submitted (eg a new form field), you need to write a provider , but if you just want to add extra text or such, you can add info fields via the hook.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM