criat Posted November 9, 2013 Share Posted November 9, 2013 To do this redirect I was trying a hook, here's what I came up with: includes/hooks/login-redirect.php <?php function onlogin_redirect($vars) { $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; header("Location: ".$url); } add_hook("ClientLogin",1,"onlogin_redirect"); ?> Didn't work though, WHMCS goes blank screen. Here's the docs for Hooks: http://docs.whmcs.com/Hooks:Clients Any help would be appreciated! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted November 10, 2013 Share Posted November 10, 2013 It's because of this. Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. In other words ClientLogin hook point comes when the page has already sent an output. You have to use an alternative method like this one for example. function onlogin_redirect($vars) { $url = "http://google.it"; echo '<script type="text/javascript">'; echo 'window.location.href="'.$url.'";'; echo '</script>'; echo '<noscript>'; echo '<meta http-equiv="refresh" content="0;url='.$url.'" />'; echo '</noscript>'; exit; } add_hook("ClientLogin",1,"onlogin_redirect"); 0 Quote Link to comment Share on other sites More sharing options...
criat Posted November 10, 2013 Author Share Posted November 10, 2013 That's awesome! Thanks for your help Kian, that really did the trick. 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.