Jump to content

Db Write Timing issue in my ClientAdd Hook


Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated