Jump to content

Easiest way to add user's details to a MySQL Database upon purchase...


ChrisWood

Recommended Posts

I am currently using Action Hooks to try and grab the User's details and add them to an external MySQL database once they have purchased a specific product.

 

Currently used Hooks:

<?php
//I then go on to define vars and add them to my db...

function cwmysql_createaccount($vars) {
$accountid =$vars['params']["accountid"];
$username = $vars['params']["username"];
$password =$vars['params']["password"];
$pid = $vars['params']["pid"];
$domain = $vars['params']["domain"];

//MORE CODE to add to db + $pid checks
}
//My Hooks
add_hook("AfterModuleCreate",1,"cwmysql_createaccount");
add_hook("AfterModuleChangePassword",2,"cwmysql_changepass"); //For password Change
add_hook("AfterModuleChangePackage",3,"cwmysql_changepackage"); //Upon upgrade of package
?>

This will only apply to specific products.

Am I doing this in the best way? Is there a better way to do this? If you have examples, that would be best. It's the best way I learn.

 

I appreciate any info/examples/advice I can get,

Chris Wood

Edited by ChrisWood
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