Extension talk:MyVariables

Hello there,

this is a very useful extension but it do not work the way i expected. This variables seem to be not actual when a page is reloaded. I changed the return value of the variable but it has the old value (after reloading the page). When i worte "Hello " on my main page an i logged out, it always shows my former login name. I thougt that this could be a caching problem, but when a fried edited the main page and I visited it afterwards, the page shows the login name of my friedn.... There is something strange about parsing the CURRENTXYZ values. Is there a solution?

Thanks in advance 88.76.203.237--
 * Yeah I've noticed that as well, I think it's that the current user variable reset after logging out after the page renders, but I'll check it out properly when I get some time. --Nad 22:09, 10 March 2007 (UTC)

Hi Nad,

i tried different ways but it is really strange and does not work. My php skills are not that good (as same as my english skills :-) ), but i ask myself how the whole session is handled. When i am logged in everything (for example MY watchlist) is rendered depending on my login name. So i think there must be a reliable information about the user which is currently logged in. (Or how does all this customized rendering work?). Naive as i am, i expected $wgUser stores this information, but obviously it does not. Greetings from Germany. ---
 * I've recently found that this extension doesn't work in 1.9.x - it works in 1.4 - 1.6.x. I'm working a lot on some 1.9's now and will need to get it going for that so I'll update it here when I get it working. --Nad 21:49, 14 March 2007 (UTC)


 * Hi Nad,
 * i hope i do not bother you. I forgot to mention, that "our wiki" is running a 1.6.9 version. I am now really suprised that you do not notice this problems in a 1.6.x version. I am running two 1.6.9 wiki on different target systems (Windows XP / PHP 5 AND Linux PHP 4) and in both i noticed this problem. I am trying to get throug the source codes but as i mentioned my skill are not that good.
 * I believe that the parsing of the wiki code does not work correctly. For testing purposes i customized your code to render
 * $user=new User;
 * $user->getName;
 * but this does also have the same "side effects". Sometimes i think this code is not really rendered each time. Then i edit the site and click on "preview" i ALWAYS get the correct value of the variable.
 * But this seems to be not only "your problem" the standard values like NUMBEROFARTICLES act the same (strange) way.
 * I hope my information are helping you anyway. Have a nice day. --193.19.114.132
 * All I can think of is that maybe the pages you're viewing are cached, it's always good to turn off the caching when experimenting with the following couple if lines in LocalSettings.php,
 * $wgEnableParserCache = false;
 * $wgOut->enableClientCache(false);
 * The $wgUser global is definately the object you want which holds the info on the currently logged in user. --Nad 20:19, 15 March 2007 (UTC)
 * Hello Nad, thank you very much for your competent help. I disabled the Cache in LocalSettings.php (only the $wgEnableParserCache=false) and everything works as i expected. Thanks a lot for your support!! Have a nice weekend! Greetings from Germany. --193.19.114.132
 * Excellent, glad to hear it's working out ;-) --Nad 21:18, 16 March 2007 (UTC)

Parser Caching?
Hello,

in 1.8.4, variables retain their values after having been computed once. Touching LocalSettings.php helps, so I'm pretty shure there must be some caching problem.


 * Workaround:set $wgEnableParserCache to false in LocalSettings.php


 * Solution:Sorry, Nad, I'm new to MediaWiki and as well to php. There must be some solution to prevent pages that contain dynamic variables from being cached. Perhaps setting some per-page flag... I don't know.

Harm in disabling?
I want to put a cool icon and edit instruction on the unedited personal page (#if on Media Wiki:Noarticletext), but then the CURRENTUSER variable has to be functional.

What will be damaged if I set $wgEnableParserCache to false? I guess at least it would make the count of the number of times each page has been displayed to go crazy... any other damages? Maybe performance? Thank you :-) --87.68.208.47 22:35, 18 May 2007 (UTC)
 * Completely disabling the parser cache will affect performance badly, especially if you have any high traffic to serve. I've added a line in to the CURRENTUSER example which marks the returned content as uncacheable, so see if that does the trick --Nad 23:38, 18 May 2007 (UTC)

More Examples?
I'm trying to create new variables with this extension that call user stats like registration date and last login of a user. It's for a template so the user is called with. Any hints? Thanks. --Subfader 21:57, 14 May 2008 (UTC)
 * It would probably be easier to make it as a parser function such as #user and make the parameter the property you want to read, that way you can easily extend the number of properties etc without having to create many different magic words. --Nad 23:28, 14 May 2008 (UTC)

Not working for me (MW1.12.0)
Hi - I've tried this using the include in LocalSettings.php, but I just get a few lines of programming superimposed at the top of the wiki page, and the variable doesn't work. Should it work in 1.12.0? Thanks. - Derrickfarnell 11:06, 19 May 2008 (UTC)