[[!UpdateProfile?
&useExtended=`0`
&validate=`email:email:required,
nospam:blank`
]]
<form action="[[~[[*id]]]]?val=somevalue" method="post">
...
This question has been answered by TheBoxer. See the first response.
Do you need the value of val variable only when the form is filled successfully, or everytime, when the form is sent (doesn't matter if the validation succeed or not) ?
I am not sure why is not preserving the get params when validation succeed...
/**
* Handle the UpdateProfile snippet business logic
* @return string
*/
public function process() {
if (!$this->verifyAuthentication()) return '';
if (!$this->getUser()) return '';
if (!$this->getProfile()) return '';
$this->setFieldPlaceholders();
$this->checkForSuccessMessage();
if ($this->hasPost()) {
$this->loadDictionary();
if ($this->validate()) {
if ($this->runPreHooks()) {
/* update the profile */
$result = $this->runProcessor('UpdateProfile');
if ($result !== true) {
$this->modx->toPlaceholder('message',$result,'error');
} else if ($this->getProperty('reloadOnSuccess',true,'isset')) {
$url = $this->modx->makeUrl($this->modx->resource->get('id'),'',array(
$this->getProperty('successKey','updpsuccess') => 1,
),'full');
$this->modx->sendRedirect($url);
} else {
$this->modx->setPlaceholder('login.update_success',true);
}
}
}
}
return '';
}
Yes, you are absolutely right, the code ignore every get param. So if you don't want to change core of Login extra, the best way should be the post hook, that will do the same as line 21 + it will add another param that you want (OR add all GET params that was sent).
<input type="hidden" name="val" value="somevalue">
$url = $this->modx->makeUrl(
$this->modx->resource->get('id'),
'',
array(
$this->getProperty('successKey','updpsuccess') => 1,
'val' => 'someValue',
),
'full'
);
$this->modx->sendRedirect($url);