Manual talk:RequestContext

From mediawiki.org

update page portlets after log-in of a user[edit]

For updating a page after successful authentication (log in) of a new user $wgUser, I use

RequestContext::getMain()->setUser( $wgUser );

--Wikinaut 19:31, 30 August 2011 (UTC)Reply

The reason I suggested that for the OpenID extension was because RequestContext::getMain()->getUser() is essentially the new $wgUser. RequestContext::getMain() returns the main RequestContext instance that's used by the $wg{Lang,User,Out,etc...} stub objects to extract their instance. You were updating $wgUser so I had you add that so it would also change the source where $wgUser came from. Naturally I don't want to see that anywhere else, in fact the auth plugin system might actually need to understand context itself. Though frankly, I have no clue why OpenID even needed to set $wgUser... the auth system should be handling that. Frankly what you were doing was problematic in other ways, since $wgUser was already unstubbed/initialized it's possible that some part of the system had already been using that anon $wgUser to do important functional things, changing the $wgUser in the middle of page run leaves us with a wiki page that may have been one user for some things, and another for others. eg: Half the permissions used to determine what to display could be based on an anon user, while the other half is based on what a sysop is supposed to see. Dantman 21:37, 30 August 2011 (UTC)Reply