tgodd Posted January 18, 2011 Share Posted January 18, 2011 I have written a hook routine for the clientedit hook. It works flawlessly with one exception. It returns to a blank page. How can I return to what would normally be displayed? 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 18, 2011 Author Share Posted January 18, 2011 I suppose what I really need is a method to redirect the page. Without the hook after edit it redirects to : hxxps://www.mypage.com/WHMCS/admin/clientssummary.php?userid=001 Whereas with the hook after edit it directs to: hxxps://www.mypage.com/WHMCS/admin/clientsprofile.php?action=savedetails&userid=001 I need to redirect it to the client summary page.. How can I do this ? 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 18, 2011 Author Share Posted January 18, 2011 By adding the following line at the exit point of the hook routine it redirects to where I need. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n<html>\n<head>\n<title>Your Page Title</title>\n<meta http-equiv="REFRESH" content="0;url=http://www.mypage.com/WHMCS/admin/clientssummary.php?userid=' . $UserId . '"></HEAD>\n<BODY>\n</BODY>\n</HTML>\n'; 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted January 18, 2011 Share Posted January 18, 2011 Maybe set a cookie or a session value? 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 19, 2011 Author Share Posted January 19, 2011 My method only works some of the time. How do I set a cookie or session value to have it return to either the admin client profile page or also acceptable would be to have it return to the admin client summary page. The hook should not return you to a blank page anyway, and I beleive this to be a bug. 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 19, 2011 Author Share Posted January 19, 2011 OK surely I am not the only one with this problem. Everything in the action hook works. The page does not reload or redirect or whatever. What is the good of hooks if the page flow is interupted.. Can ANYONE help here???????? 0 Quote Link to comment Share on other sites More sharing options...
JofleyUK Posted January 19, 2011 Share Posted January 19, 2011 Have you looked at your MaxExecutionTime variable in php, make sure its set to 120 or higher, it could be timing out before completing the script. 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 19, 2011 Author Share Posted January 19, 2011 Have you looked at your MaxExecutionTime variable in php, make sure its set to 120 or higher, it could be timing out before completing the script. I did try adding set_time_limit(120) to my hook code. Still the page does not return or redirect. I do certainly appreciate your help and suggestions. FYI I have the latest stable version installed. 0 Quote Link to comment Share on other sites More sharing options...
tgodd Posted January 19, 2011 Author Share Posted January 19, 2011 I have done this and still does not direct to a page (page remains blank). I have even tryed a clientadd hook that does nothing, and the page still does not redirect. 0 Quote Link to comment Share on other sites More sharing options...
gohigher Posted March 29, 2011 Share Posted March 29, 2011 I'm glad I'm not the only one going crazy here... I have also encountered this issue in coding a couple of routines for the contactadd and contactedit hook points. I can verify that my hook functions are indeed completing, and can have it die with an error message on the last possible line, even adding a routine to just output something in a lower priority to verify that I didn't miss something. The code is simply stopping, it appears to be a redirect issue, but unsure how best to resolve this as I agree it must be a bug that should be resolved in future releases. I do know that contacts and clients behave differently in the way they are handled... here is what I've gathered in the hook behavior: The hook on the BACKEND CLIENT ADD passes only entered info (including clear text password and new userid) The hook on the BACKEND CONTACT ADD passes full info from DB, encoded password, no contactid, userid from client, subaccount field The hook on FRONTEND CLIENT ADD passes only entered info (including clear text password and new userid) The hook on FRONTEND CONTACT passes full info from DB, encoded password, no contactid, userid from client, subaccount field Hope that is of use to someone. Regards, Steven 0 Quote Link to comment Share on other sites More sharing options...
gohigher Posted March 29, 2011 Share Posted March 29, 2011 @tgodd Just wanted to say thanks for the tip on the meta refresh work around; works like a champ! 0 Quote Link to comment Share on other sites More sharing options...
gohigher Posted March 29, 2011 Share Posted March 29, 2011 In case other developers are interested - know thy functions... I was calling a flush() deep in my code that was pushing output to the browser and breaking the redirect. It seems to be working properly now... doh! 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.