I've been fighting this issue since I upgraded two weeks ago, I finally understand where the error is but I'm unsure how to fix it. I have a custom field that needs to be upgraded after a purchase is complete. The problem is that the "onAccessAfterInsert" hook is called while the paypal transaction is still pending. In my plugin I'm calling "$user->getActiveProducts" but since this function is being called while the transaction is still pending the newly purchased product is not included in the return. What is the best way to get the product ID of the newly purchased product so that I can use that to make an entry into my custom field. Here's what I have so far: PHP: function onAccessAfterInsert(Am_Event $event) { $this->updateXin($event->getAccess()->getUser()); } function onAccessAfterDelete(Am_Event $event) { $this->updateXin($event->getAccess()->getUser()); } function onAccessAfterUpdate(Am_Event $event) { $this->updateXin($event->getAccess()->getUser()); } function updateXin($user) { $productIDs = $user->getActiveProducts(); $URLs = 0; foreach($productIDs as $productID): switch($productID->product_id): case 6: $URLs += 100; break; case 11: $URLs += 175; break; case 16: $URLs += 350; break; endswitch; endforeach; $user->urls = $URLs; $user->save(); } this works for products that have been purchased previously but not new ones. The Am_Event from onAccessAfterInsert includes access to the invoice. Do I need to use invoice->getItems()? Why does the system enter data into the access table while the invoice is pending? Or maybe a better question - why is the user granted access via the access table while the invoice is still pending? Thank you
User's status and invocie status will be updated later so you can't use $user->getActiveProducts here. use Am_Di::getInstance()->accessTable()->getStatusByUserId($user_id, 1); 1- active Function will return array($product_id => $status)