Topic on Project:Support desk

How to display the Username or IP in a wiki page or template?

3
Matjung (talkcontribs)

Preferably without installing any extension, I would like to display the username or IP address of the browser that visits the page.

Within magic words and ParserFunctions I did not find what I am looking for.

This extension Extension:UserFunctions contains some severe warnings.

The extension Extension:GetUserName displays only a name, but not an IP

Perhaps the extension Extension:MyVariables provides a solution.

The extension Extension:Variables indicates that WMF prefers not to work with it and points to Extension:Scribunto/Lua reference manual

Given that my username gets displayed at the top right corner, I would expect that a page or template could also display that name.

What are my options?

MarkAHershberger (talkcontribs)

The reason you can't find this sort of thing is because it isn't something that works well with the level of caching needed by Wikipedia.

To get around that, you need something that happens at the browser level. It seems like to me that the best way to handle that would be to insert a marker like

<span class="substitute-username-here">User's name</span>

wherever you want to have the user's name to be displayed and then use Javascript to find instances of span.substitute-username-here and replace the body with the user's name or ip.

Bawolff (talkcontribs)

the warnings on user functions is probably a bit extreme, i would suggest just using that.

The warning is basically, that its possible to setup a wiki page to load different images (or something) based on who is viewing it, then the person who did that can look to see which image was viewed to figure out which person viewed the original page. If you're worried about that be careful, but its a pretty minor attack so i think most people should probably just not care.

Reply to "How to display the Username or IP in a wiki page or template?"