freedomfflow Posted July 28, 2014 Share Posted July 28, 2014 I have a 'timing' problem I believe. I have a script that I'm triggering that is using the API to create a client. I'm using this API option in my postfields: $postfields["action"] = "addclient"; This is working perfectly. However, I also have a hook: add_hook("ClientAdd",10,"papMigration",""); In my hook, I have the following SQL statement: $sql = "SELECT * FROM mywinnet_cart.tblclients as c INNER JOIN mywinnet_cart.tblcustomfieldsvalues as cf ON cf.relid = c.id WHERE c.id='".$userData['userid']."' AND cf.fieldid='3'"; PROBLEM: I've discovered, after many hours of scratching my head and breaking out the JOIN into separate SQL statements, the following problem: In my hook, which is being triggered by the 'ClientAdd' hook point, the data exists in the 'tblclients' table, but it DOES NOT EXIST YET' in the tblcustomfieldsvalues table!!! So in my hook, my query fails, and I can't do what I need to do (which is provision account data to a 3rd party system... post affiliate pro). QUESTION: Is there another hookpoint I can use, or some way to force the data to be written in my current hook, so that the tblcustomfieldsvalues data is present while my hook is executing. Please Help!! 0 Quote Link to comment Share on other sites More sharing options...
freedomfflow Posted July 29, 2014 Author Share Posted July 29, 2014 I was able to confirm the following: The hook point ClientAdd does not have the customfields available to it as it runs immediately after adding the client. However, the ClientDetailsValidation hook point does contains the client data and custom fields: http://docs.whmcs.com/Hooks:ClientDetailsValidation 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.