Last modified: 2007-06-30 04:23:25 UTC
Created attachment 3841 [details] The code This is my first attempt at a patch for MediaWiki, so it is a small change. This patch adds a (view log) link next to the users name on Special:userrights. This interface is used usually by stewards. The text is cusomizable by the system message "userrights-loglinktext", which by default is set to "view log". Thanks!
You seem to be calling a parse operation in order to build a simple link. Investigate the Linker and Skin classes.
(In reply to comment #1) > You seem to be calling a parse operation in order to build a simple link. > Investigate the Linker and Skin classes. > Ok, is the parse operation too expensive? I'll try it another way.
By comparison, yes. It's also a very sloppy way of doing it - we don't build UI links in that fashion. I would recommend that, rather than just linking to the rights log, you investigate the possibility of adding the log fragment at the bottom of the page when a valid target is specified.
(In reply to comment #3) > By comparison, yes. It's also a very sloppy way of doing it - we don't build UI > links in that fashion. > > I would recommend that, rather than just linking to the rights log, you > investigate the possibility of adding the log fragment at the bottom of the > page when a valid target is specified. > I'll investigate adding a fragment on the bottom, I don't know whether this would invlove similair things to transclusion, i'm supposing I can't just go $wgOut->parse("{{Special:Log/rights?page=User:NAME}");. I am attaching another patch, using Linker as well as several other tweaks. It works a lot better now.
Created attachment 3843 [details] Patch V2
You don't instantiate Linker; use a Skin instead. The current user's Skin can be obtained using `$GLOBALS['wgUser']->getSkin()`
Created attachment 3844 [details] Patch V3 This has some benefits, it shows the log in the page, and is properly customizable. It also uses the users skin instead of a new Linker.
Fixed in r23580. I couldn't use the provided patch, however; it didn't honour the safe construction of localised titles, abused Linker::makeKnownLink() [deprecated], and contained odd bits like appending a misplaced </div> in the log fragment function.