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!!