Extension:UserMagic

UserMagic allows editors to place the name of the current user inside the content of an article, without affecting the page cache. This is done by replacing magic words inside the fully-parsed HTML after the page has been rendered and cached.

Currently defined magic words:
 * __USERNAME__ -> Name of the current user
 * __USERPAGE__ -> Link to the page of the current user
 * __USERIP__ -> IP address of the current user

Caveats
Since the magic words are not replaced until after the HTML is rendered, they cannot be used as the target of links or as template arguments. However, they can still be used as the alternate text of links, e.g. __USERNAME__

Additionally, since  tags will have already been parsed out, these magic words cannot be invalidated by. In order to explicitly print one of these words, &amp;#95; must be used in place of an underscore.

Lastly, these magic words will not be replaced in Preview mode.

Code
This code has been tested in MediaWiki 1.7.