jimsweb Posted October 2, 2020 Share Posted October 2, 2020 Hello - appreciate if someone could guide me here. the following logout hook has been working correctly so far. However it stopped working when i upgraded to v 8.0. Can anyone comment why this hook failing after upgrade? /** redirect to login page without taking then to WHMCS domain search page when user logs out */ <?php function logout_redirect($vars) { header( 'Location: https://xxxxxx.com/clientarea.php' ) ; } add_hook("ClientLogout",1,"logout_redirect",""); ?> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 2, 2020 Share Posted October 2, 2020 9 minutes ago, jimsweb said: Can anyone comment why this hook failing after upgrade? because the ClientLogout hook point got deprecated in v8, you should be able to use the UserLogout hook point in the same way, but i've not tested that yet. 1 Quote Link to comment Share on other sites More sharing options...
jimsweb Posted October 2, 2020 Author Share Posted October 2, 2020 thank you @brian! i trried out following code per your suggestions, still it is not working.. please comment if i'm doing it wrong or not. /** redirect to login page without taking then to WHMCS domain search page when user logs out */ <?php function logout_redirect($vars) { header( 'Location: https://xxxxxx.com/clientarea.php' ) ; } add_hook("UserLogout",1,"logout_redirect",""); ?> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 3, 2020 Share Posted October 3, 2020 the following hook should work... <?php add_hook('UserLogout', 1, function($vars) { header('Location: clientarea.php'); exit; }); remember that if you're redirecting to another WHMCS page, you shouldn't need to use the full URL. 2 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted October 3, 2020 Share Posted October 3, 2020 Hi @brian! will this hook work for both primary and contacts both ? Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 3, 2020 Share Posted October 3, 2020 (edited) 26 minutes ago, VirtualWorldGlobal said: will this hook work for both primary and contacts both ? it's a v8 hook and only users can login into v8 - so as written, the hook should redirect every user logging out to the same URL. to predict the next question you're thinking - can you detect whether the user is a user or an owner and redirect them to different locations ?? the answer should be yes, you just need to determine who the user is and redirect accordingly. Edited October 3, 2020 by brian! 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted October 3, 2020 Share Posted October 3, 2020 (edited) 50 minutes ago, brian! said: to predict the next question you're thinking - can you detect whether the user is a user or an owner and redirect them to different locations ?? the answer should be yes, you just need to determine who the user is and redirect accordingly. 😄 😃 😃 😄 😃 I am not going to do that again. Clients were just going round and round after login, they clicked billing to pay their invoices and again landed up to home. I am looking for something which can automatically take clients to - https://domainname.com/clients/clientarea.php I also wanted to know about a hook and have messaged you, can you please have a look. Thanks Edited October 3, 2020 by VirtualWorldGlobal 0 Quote Link to comment Share on other sites More sharing options...
jimsweb Posted October 3, 2020 Author Share Posted October 3, 2020 (edited) 1 hour ago, brian! said: the following hook should work... <?php add_hook('UserLogout', 1, function($vars) { header('Location: clientarea.php'); exit; }); remember that if you're redirecting to another WHMCS page, you shouldn't need to use the full URL. thank you @brian! it worked perfectly. Now my users are able to see login scree as soon as they click 'logout'!!! Edited October 3, 2020 by jimsweb 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.