Page MenuHomePhabricator

{{{realName|{{{name}}}}}} does not work
Open, In Progress, LowPublic

Description

If I put {{{realName|{{{name}}}}}} into the welcome template, the real name gets show if it is provided. However, the username {{{name}}} is omitted if no real name {{{realName}}} was provided on registration. REL1_22, MW 1.22.15, PHP 5.4.32

Event Timeline

Kghbln raised the priority of this task from to Needs Triage.
Kghbln updated the task description. (Show Details)
Kghbln subscribed.
Kghbln set Security to None.

In MediaWiki core, the realName value defaults to an empty string (unbeknownst to NewUserMessage).

In NewUserMessage, the realName parameter is unconditionally set. If you wish to conditionally use it based on whether it has a value and fallback that way, you'd have to use something like the ParserFunctions #if magic word. Like: {{#if: {{{realName|}}} | {{{realName}}} | {{{name}}} }}.

Alternatively, the NewUserMessage extension could check each parameter and build up the template transclusion parameters based on the presence and thus allow {{{realName| {{{name}}} }}} to work. However that might be unconventional and inconsistent with other templates, and also break compatibility with existing wikis that assume the parameter to be present. The problem being that if a template uses {{{realName}}} somewhere, it would result in the literal code {{{realName}}} to be displayed to a user, whereas now it falls back to an empty string.

We can announce a backwards-incompatible change that requires users to add a pipe (|) to ensure it falls back.

Krinkle triaged this task as Medium priority.Jan 22 2015, 7:05 PM
Krinkle added a project: good first task.

Thank you very much for your insight. Well I guess I could/should have thought of using the #if parser function myself. So yes, this solution works perfect when the ParserFunctions extension is present.

I think it will still be nice to have this working out of the box as it used to in the past, ensuring fallback. The {{{realName| {{{name}}} }}} syntax was afaik the recommended way for this extension from its beginning.

Since most wikis have the ParserFunctions extension installed and if not since it is very easy to install it, this will probably not be a front-burner issue.

Shogil subscribed.

Removing task assignee due to inactivity, as this open task has been assigned for more than two years (see emails sent to assignee on May26 and Jun17, and T270544). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be very welcome!

(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Aklapper lowered the priority of this task from Medium to Low.May 10 2022, 9:41 AM

Change #1301750 had a related patch set uploaded (by Neriah; author: Neriah):

[mediawiki/extensions/NewUserMessage@master] substString: omit realName param when empty

https://gerrit.wikimedia.org/r/1301750

neriah changed the task status from Open to In Progress.Sun, Jun 14, 5:20 PM
neriah claimed this task.
neriah moved this task from Backlog to Working on on the MediaWiki-extensions-NewUserMessage board.