Closed (fixed)
Project:
Pay-per-node
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2007 at 23:26 UTC
Updated:
31 May 2007 at 10:32 UTC
Jump to comment: Most recent file
Comments
Comment #1
docStone commentedChanging this to bug report...
I've duplicated the behavior on a vanilla install now.
Comment #2
docStone commentedOK, I have some more information on this...
from this comment in my other thread: http://drupal.org/node/113977#comment-194714
I'm looking at the module, and I think here is where the problem lies for sure:
---
You can read the rest of the comment over there if you want, but the gist is that the global $user is not set, which is why the anonymous user is getting the credit. If manually set a user, then the credit is assigned to that user properly.
I'm speculating that this has to do with leaving drupal and processing the payment via paypal, which would explain why it works for other folks (Again, speculating that they are not using paypal for processing) and not for me...
I'm going to try and track down info on getting the users context, but I suspect it has something to do with the IPN ping.
-doc
Comment #3
docStone commentedI now have this functioning...
the problem is that the global user is not available to the IPN page, since it's called by paypal not an actual user. I kind of suspected that.
With a little poking around at similar problems on the forums I finally got the one piece I needed to fix this...
in the on payment completion I needed to grab the UID of the user making the purchase another way... here's what I have:
then, you have to make a minor change to the call to paypernode, see my changed line below:
This is NOT an elegant solution, it's just one that works.
Hope it's helpful to someone else in the future.
Comment #4
docStone commentedSeems there is one more problem for me:
I've found that the when content is created, it doesn't get deducted properly!
this fix is simple, you need to add global $user; (it works here!) so the proper user gets the deduction done in the function: paypernode_nodeapi
should look like this:
Comment #5
jose reyero commented> I'm speculating that this has to do with leaving drupal and processing the payment via paypal,
Yes that is the problem. So it won't work with these payment methods.
Comment #6
marcoBauli commentedapplyed the patch above and followed steps posted on forum thread at http://drupal.org/node/113977
but i get the following warning:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: paypernode_productapi SELECT uid FROM ec_transaction WHERE txnid = in /home/public_html/test/includes/database.mysql.inc on line 120.no node credits assigned nowere, not to authenticated nor to anonymous users.
Used COD as payment method. Help apreciated!
Comment #7
marcoBauli commentedattaching a patch that solves the problem. Works fine here now :)
Comment #8
jose reyero commentedLooks good, applied with a few changes. Thanks.
Comment #9
(not verified) commented