[Mediawiki-l] Getting User Data in Extension

MK halfcountplus at intergate.com
Sat Aug 21 22:43:15 UTC 2010


I need a way to get the user's name and password to obtain an "edit"
token to use with api.php for a form that will be a special page in an
extension.*  I'm doing this as a volunteer for the FSF, so any advice
would be much appreciated ;)

I'm not much with php, but I tried testing this based on what I could
glean from Manual:Special_pages and includes/User.php:

	function execute($par) {
		global $wgOut, $wgUser;
		$tmp = $wgUser->mCacheVars['mName'];
		$wgOut->addWikiText("$tmp");
	}  

However, this results in:

Undefined property: User::$mCacheVars
in /usr/share/mediawiki/extensions/TestExt/TestExt_body.php on line 12

Ie, I seem unable to access any of the variable or functions that are
part of User although the User object is recognized.  What am I doing
wrong?

* further clarification: the extension needs to include a special page
for adding new pages to the wiki (the pages have a fairly complex
format including Semantic mark-up that the user should not need to
understand) but these need to be 1) restricted to privileged users, 2)
be added via the special page/form->api.php including the real,
specific user who added the page.

-- 
MK <halfcountplus at intergate.com>



More information about the MediaWiki-l mailing list