This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

redirect

In UserSpice 4.3 and Below · Started by matt on 2017-11-08 8:05 am · 12477 views · 5 replies

How would you redirect certain users to page on login?

I know there is a custom login script but not sure what to add??

Regards

Matt
Redirect::to('whereyouwantthemtogo.php');
I have tried the below code but still gives an error?


<?php
//Whatever you put here will happen after the username and password are verified and the user is "technically" logged in, but they have not yet been redirected to their starting page. This gives you access to all the user's data through $user->data()

if (checkMenu(4,$user->data()->id)){
Redirect::to($us_url_root.'users/account2.php');
else {
Redirect::to($us_url_root.'users/account.php');

}



}

//Where do you want to redirect the user after login



?>
What error is it giving you? One thing I can see is that you have your else within your checkmenu, so there is no "else".

You should have:
if (checkMenu(4,$user->data()->id)){
Redirect::to($us_url_root.’users/account2.php’);
} else {
Redirect::to($us_url_root.’users/account.php’);
}
Parse error: syntax error, unexpected 'else' (T_ELSE) in /home/firstti7/public_html/insightfulsearch.co.uk/con/usersc/scripts/custom_login_script.php on line 6

Bascially I would like users who have permission 4 to direct to another page?
Thank you - managed to get it working.

Thanks again