Log in

View Full Version : Redirect on Registration/Activation


Wayne Luke
08-21-2005, 12:19 AM
Anyone have any ideas on how I can automatically redirect someone into their CP upon registration after their email is activated? I have a community where you have to be in particular secondary groups to get the full benefit and want them to be redirected to this first thing.

amykhar
08-21-2005, 01:49 AM
I did it on my forum for a while, but it required a code edit.

In register.php, find
eval(standard_error(fetch_error('registration_comp lete', $userinfo['username'], $vbulletin->session->vars['sessionurl'], $vbulletin->options['bburl'] . '/' . $vbulletin->options['forumhome'] . '.php'), '', false)); in the do=activate section.

Comment it out and replace it with something along these lines.:

// Send the User to their usercp
$vbulletin->url = "usercp.php". $vbulletin->session->vars['sessionurl'];

eval(print_standard_redirect('registration_complet e'));

Andreas
08-21-2005, 02:17 AM
Can also be implemented as a Pugin.
Hook: register_activate_process

if (!($userinfo['coppauser'] OR ($vbulletin->options['moderatenewmembers'] AND !$userinfo['posts'])))
{
$userdata->save();
$username = unhtmlspecialchars($userinfo['username']);
if ($vbulletin->options['welcomemail'] AND !$userinfo['posts'])
{
eval(fetch_email_phrases('welcomemail'));
vbmail($userinfo['email'], $subject, $message);
}
$vbulletin->url = "usercp.php". $vbulletin->session->vars['sessionurl'];

eval(print_standard_redirect('registration_complet e'));
}


Please note that this Plugin must be the last one executed on this Hook!

amykhar
08-21-2005, 02:40 AM
And how do you make it the last one run on the hook? That's why I didn't do mine as a plugin :D

Wayne Luke
08-21-2005, 02:23 PM
Thanks.. without an order number for processing hooks, wondering the same issue.

Andreas
08-21-2005, 02:35 PM
Well, i've got a neat Form "Set Execution Order" to ensure that ;)

Boofo
08-22-2005, 01:21 PM
Well, i've got a neat Form "Set Execution Order" to ensure that ;)

And where is that?

Andreas
08-22-2005, 01:23 PM
That's part of APM ;)

Boofo
08-22-2005, 01:32 PM
Ok, you got me. What is APM?

Sychev_S
03-02-2007, 03:51 AM
Is it possible to do the same thing right after user registers (not activates)?
if i change hook location to register_addmember_process it does redirect but the user is not logged in so instead of usercp it shows error login page...

buuump