PDA

View Full Version : Redirect after submit


steven s
12-28-2005, 01:49 AM
On the edit profile page there are buttons <input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
After hitting submit you are taken from profile.php to usercp.php.
I would like to go to a custom page, newthread.php?do=hpde.

One site I found recommended
onclick="document.location = '/index.php';"
Well that didn't work or I did do it correctly.

Any hints?

Marco van Herwaarden
12-28-2005, 06:01 AM
In profile.php, find and change the following lines:

if (empty($vbulletin->GPC['gotopassword']))
{
$vbulletin->url = 'usercp.php' . $vbulletin->session->vars['sessionurl_q'];
}
else
{
$vbulletin->url = 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editpassword';
}

eval(print_standard_redirect('redirect_updatethank s'));


Maybe adding a plugin to the hook location 'profile_updateprofile' with something like the following will also work (but is risky):
if (empty($vbulletin->GPC['gotopassword']))
{
global $userdata;
// save the data
$userdata->save();
$vbulletin->url = YOUR REDIRECT URL;
eval(print_standard_redirect('redirect_updatethank s'));
}

steven s
12-28-2005, 11:42 AM
To continue from last post.
Thank you. Editing profile.php worked just fine.
Although if the person is on the edit password page they will be redirected to the wrong page otherwise the redirect is exactly what I am looking for. In the statement. // save the data
$userdata->save();

if (empty($vbulletin->GPC['gotopassword']))
{
$vbulletin->url = 'usercp.php' . $vbulletin->session->vars['sessionurl_q'];
}
else
{
$vbulletin->url = 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editpassword';
}I'd like to add a statement

If $vbulletin->url = 'profile.php?do=editdereg' . $vbulletin->session->vars['sessionurl_q'];
Then goto $vbulletin->url = 'newthread.php?do=hpde' . $vbulletin->session->vars['sessionurl_q'];
So I can retain the original function of the statement. Is that possible?

Thanks again.