dan76 Posted October 17, 2009 Share Posted October 17, 2009 I created a simple hook to redirect a user to a page after logging out. Using the same logic, I tried creating another hook to redirect a user after logging in. However, this is not working. Here's what I have: <?php function login_redirect($vars) { header( 'Location: https://www.my-redirect-here.com' ) ; } add_hook("ClientLogin",1,"login_redirect"); ?> What could I be missing something? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 17, 2009 Share Posted October 17, 2009 Just to cover all bases... but did you put that hook file in WHMCS/includes/hooks directory Also you should have the name of the file at the end of the url that you are redirecting to. 0 Quote Link to comment Share on other sites More sharing options...
dan76 Posted October 18, 2009 Author Share Posted October 18, 2009 Yes, the file is included in the hooks directory. And even when I add the file name to the url the problem still persists. Could this be a bug? I created a similar hook created for a redirect after logout, and this hook works perfectly (even without a file name). For some reason, the same logic is not working for the ClientLogin hook point. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 18, 2009 Share Posted October 18, 2009 Try it like this by adding exit; on the next line function login_redirect($vars) { header("Location: http://www.example.com/"); exit; } add_hook("ClientLogin",1,"login_redirect"); 0 Quote Link to comment Share on other sites More sharing options...
dan76 Posted October 18, 2009 Author Share Posted October 18, 2009 That did it! Thanks for your help Sparky. 0 Quote Link to comment Share on other sites More sharing options...
webio Posted June 1, 2010 Share Posted June 1, 2010 Does anyone know how to update login hook function to not redirect when user is in new account creation and ordering process? When hook is applied this is how it looks: 1. Client is choosing hosting plan 2. Entering his new account details 3. He is trying to checkout and now instead of finishing order he is being redirected to place where login hook is redirecting and ordering process is not being finished. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.