Session ID is passed back as a http value. Take a look at this code:
if( isset( $_GET['session'] ) ) {
$session_id = $_GET['session'];
You can see a bit more on the tech tutorial at https://www.youtube.com/watch?v=X8btdGoCw5E
–David
P.S. As for selling add-ons, we’ll see. So far it’s not paying the hosting fees, so my wife is less than amused. But I’m just starting out with one tiny add-on, so we’ll see how long I get to keep coding before I get summoned back to family yard work! 🙂
David
I tried
if( isset( $_GET[‘session’] ) ) {
$session_id = $_GET[‘session’]; }
(as per your excellent video) but the table did not update
I hard coded a $session_id to test the rest of the query and this worked fine
Am I missing something. Thanks for your help
Michael
The audit table is written on the outbound path to PayPal. When the IPN comes in, you’re passed a session ID you can act on (usually with a nonce). All that session ID does is give you an index into the record within the audit table, which you then need to unserialize.
The data in the audit table always stays tied to that id, but you have to be able to get the id in order to use it as an index. That ID isn’t exposed all that often, but it is available as a return value from PayPal.
Not sure if that helps. Let me know.
–David
David
I think I understand
Does the SESSION ID still exist when this hook is called
‘seamless_donations_paypal_ipn_processing_complete’. So far no success here.
If not what is the best hook to use?
If this is not going to work then is there a hook that takes the donation PostID as input and hence get the SessionID from post_meta.Looks like the PostID for the fund is not in the meta (Just the name) so I still need to go to the audit table ??
Appreciate your thoughts and support
Regards
Michael
Hi again
I got it!
The session id is passed into this hook ‘seamless_donations_paypal_ipn_processing_complete’ and that seems to have done the job
Regards
Michael
Yay! Code is fun, isn’t it? 🙂
Just remember that the session ID, while permanent (in that I don’t delete it from the audit table), represents the donation before it’s been recorded as a donation. There is no linkage between the final, recorded donation you see as a custom post type and the session ID.
Normally, that’s not a problem, but it’s just good to be aware of. Back when I adopted the plugin, that session data was actually a transient that magically vanished shortly after it was recorded. I’m keeping the audit table because the transient nature made everything wonky on different hosts, but I don’t want people to get the idea that that table contains the “donation of record”. It’s just the user-entered data at the start of the transaction.
–David
P.S. Basically because someday, if people are able to edit or modify or add to a donation, they’ll do it to the custom post type and not that originating transaction.
P.P.S Marking as resolved, ’cause you got it working!