Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to get needed parameters and info in plugin (request-arguments)?*
wzttest1
New
Hello:
I'm developing plugin for vanilla.I want to know how to get the parameters in plugin to know what controller/method/forum/thread/reply has been read or operated in current page?
Now I can only get some info by the $_REQUEST['p'] parameter,but it is not enough,it is not reliable in some rewrite rule applied sites.
I need judge these info in my plugin,so I can control what need to do in my plugin.
Thanks.
Tagged:
0
Comments
what you are looking for is called
RequestArguments
, you are right in thinking you should avoid using$_REQUEST
or$_GET
as this should be abstracted.it depends on contents but usually in a controller hook you would use
$Sender->RequestArgs
it is an array of arguments. so if you have example request:/discussion/love/param1/param2
RequestArgs will contain
[param1,param2]
If you just want to the check the request method use
'$Sender->RequestMethod
that will containlove
method. If there is basically no method it will usefully be 'index', but you can debug to find out.If you want the controller name, such as when you are using
Base_
you can usestrtolower($Sender->ControllerName)
which will producediscussioncontroller
If you just want the request path use
$Sender->Request->Path()
orGdn::Request()->Path()
for short this will contain/discussion/love/param1/param2
grep is your friend.
Hello x00:
Great.
Deeply Thank You!
This is what I want.
You are so handsome.:)