Hi everyone, Im trying to integrate the aMember script with my own web service. I want to make a INSERT in a customized mysql table when a user got a new subscription, and want to DELETE one row on the table when the user got the subscription suspended or cancelled. First im trying to get working the INSERT when new subscription was added to user. I tested it, creating a new user, and adding a subscription on the admin panel. (maybe this is wrong? ) Here's the code Im ussing: On /www/secure/amember/application/configs/site.php PHP: <?include_once("../../../includes/config.php"); Am_Di::getInstance()->hook->add('subscriptionAdded', 'subscriptionAdded'); function subscriptionAdded(Am_Event $event){ $user = $event->getUser(); $product = $event->getProduct(); $userid = $user->$user_id; $username = $user->$login; $email = $user->$email; $acc_status = $user->$status; $ip = $user->$remote_addr; $createdby = "1";$query = mysql_query("INSERT INTO users (idUser, username, email, user_level_id, acc_status, ip, createdby) VALUES ('".$userid."', '".$username."', '".$email."', '3', '".$acc_status."', '".$ip."', '".$createdby."')"); }?> The config.php is the mysql_connection file. What is grown? Thanks
I had fixed this problem! If anyone have questions about how to fix it, I will explain. I troubleshoot each step of the process, and find that the variables "$user->$email" was wrong, and should be "$user->email". Another problem was the database connection. I don't know why but dind't work with the included file! The file was included, but don't get a few variables to stablish the connection. I copy all the connection parameters to that file, and it's works.