Is there a “special” way in mediawiki to get parameters passed by URL or do you just use the conventional PHP way ($_GET)? I am trying to check if “Special:CreateAccount?reason=“ is set/has a value (and what that value is).
Thank you for your assistance, trying to be convention compliant. -TheSandDoctor
MediaWiki coding conventions is to use the WebRequest object.
In the context of a SpecialPage subclass, you would probably do $this->getRequest()->getVal( 'reason' ); [Note: This combines both POST and GET values]
See https://doc.wikimedia.org/mediawiki-core/master/php/classWebRequest.html#a3e... for more details.
-- Brian
On Tue, Oct 1, 2019 at 7:51 PM John Shepherd MajorJohn1@mail.com wrote:
Is there a “special” way in mediawiki to get parameters passed by URL or do you just use the conventional PHP way ($_GET)? I am trying to check if “Special:CreateAccount?reason=“ is set/has a value (and what that value is).
Thank you for your assistance, trying to be convention compliant. -TheSandDoctor
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Thank you for this. I have tried setting my own custom key-value pair (e.g. using $this->getRequest()->setVal( 'reasonConfirm', 1 ); ), but I cannot seem to retrieve it when the page reloads. I've tried both getVal (returns null every time) and getInt (always returns '0') to no avail. Is there a special way to set your own custom variables?
Interestingly, I have also noticed that my return $this-msg() text is no longer displaying at all. When my validation callback is triggered, only the top "There are problems with some of your input." appears. I have checked en.json and can confirm that the message that should be displayed is still present and is properly formatted.
-TheSandDoctor
-----Original Message----- From: Wikitech-l wikitech-l-bounces@lists.wikimedia.org On Behalf Of bawolff Sent: October 1, 2019 1:12 PM To: Wikimedia developers wikitech-l@lists.wikimedia.org Subject: Re: [Wikitech-l] URL parameter fetching (mediawiki)
MediaWiki coding conventions is to use the WebRequest object.
In the context of a SpecialPage subclass, you would probably do $this->getRequest()->getVal( 'reason' ); [Note: This combines both POST and GET values]
See https://doc.wikimedia.org/mediawiki-core/master/php/classWebRequest.html#a3e... for more details.
-- Brian
On Tue, Oct 1, 2019 at 7:51 PM John Shepherd MajorJohn1@mail.com wrote:
Is there a “special” way in mediawiki to get parameters passed by URL or do you just use the conventional PHP way ($_GET)? I am trying to check if “Special:CreateAccount?reason=“ is set/has a value (and what that value is).
Thank you for your assistance, trying to be convention compliant. -TheSandDoctor
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org