The code above only gets called when a free product is given or when a product is marked as completed. Such as in case of manual payment or if the ipn transaction from paypal never arrives.
Next step. What the status of the transaction under the Transaction log after the payment was completed.
If it is marked as pending and remains pending even after 15 minutes check that you are able to access
http://www.yourforum.com/storeipn.php If you get a server configuration error make sure that the permission of the file is set to at least 755