Hi, I have a custom field for my aMember user record and would like to redirect the user depending on the value of this field. This should happen after the user logged in using the aMember widget (if($api->isLoggedIn())): Something like: if value == a then redirect to url_a else redirect to url_b Thanks!
Hello, Here is example of code that you can use in site.php: http://www.amember.com/docs/Site.php_file PHP: Am_Di::getInstance()->hook->add(Am_Event::AUTH_GET_OK_REDIRECT, function(Am_Event $e) { $user = $e->getUser(); switch($user->fieldname) { case 'a' : $e->setReturn('/redirect/url/a'); break; case 'b' : $e->setReturn('/redirect/url/b'); break; case 'c' : $e->setReturn('/redirect/url/c'); break; } }); Reference: http://www.amember.com/docs/API/HookManager
Hi Caesar, I have a similar problem, except that I am looking to simply redirect the user to the referring page. The referring url is http://www.banknews.tv/fullreport_1.php?id=52 goes to http://www.banknews.tv/amember/login and then return to http://www.banknews.tv/fullreport_1.php?id=52 Script to launch login from referring page is: window.location.href = "amember/login";
You can navigate to aMember CP -> Configuration -> Setup/Configuration -> Login Page and switch option 'Redirect After Login' to 'Page Where Log In Link was Clicked' Best Regards.