There should be a parser function to test whether a user account exists.
- {{#ifexist:User:Username}} only tests whether the userpage exists. Since userpages can exist independently of having an associated user, this doesn't work. A user may exist, but have a redlinked userpage. Or a userpage may exist for a user that doesn't.
- {{GENDER:Username}} doesn't work either. If queried with a non-existent user, it returns its default (gender-neutral) value, rather than erroring out.
Use cases
- Use case one: Many templates take a username, e.g. userlink templates like https://en.wikipedia.org/wiki/Template:User. Such templates could say if the user doesn't exist (for example due to a typo).
- Use case two: Some users incorrectly think an account doesn't exist when a red user page says the page doesn't exist. For their own account, they think the account is broken. Red user pages display MediaWiki:Newarticletext which could be customized to say this user account exists but has not created an optional user page. If the account doesn't exist, then MediaWiki:Userpage-userdoesnotexist is displayed, but most users don't know that.
Notes
- Need to look up value in https://www.mediawiki.org/wiki/Manual:User_table
- User.php has method for this probably: https://www.mediawiki.org/wiki/Manual:User.php or https://www.mediawiki.org/wiki/Manual:UserFactory.php
If there were a more general function to pull a user's userID based on their username, that would probably work better, such as {{#userID|username}} based on getId().