Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Access $current_user from paypal.php

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Access $current_user from paypal.php

  • This topic has 4 replies, 2 voices, and was last updated 14 years, 1 month ago by g01010.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 7, 2011 at 8:43 pm #3546
    g01010
    Member

    Hi – On my site I’m using the eStore plugin to allow users to purchase credits. I’d like to update the number of credits that a logged-in user owns by this simple bit of code, where $credits is the new value:

    global $current_user;
    get_currentuserinfo();
    $user_id = $current_user->ID;
    update_user_meta( $user_id, 'credits', $credits );

    So that code works fine anywhere on my site, except when I try to use it within paypal.php. I can hardcode the value of $user_id and it will update the user’s credits field (so I know everything else is working correctly) but when I try to access $current_user->ID, it just returns 0.

    What am I doing wrong?

    June 8, 2011 at 2:11 am #33116
    amin007
    Participant

    The IPN (payment notification) is a background HTTP POST. When paypal sends the IPN to eStore there is not active user present so current user variable does not return anything.

    If you have integrated the PDT then you should try to do this credit update work there as the current user will be active in the browser and it will have the details of this user.

    June 8, 2011 at 5:00 am #33117
    g01010
    Member

    Thank you – can you just point me to the file I need to be working in for the PDT?

    June 8, 2011 at 5:14 am #33118
    amin007
    Participant

    Please open the “wp_eStore1.php” file and search for the following line:

    /*** PDT Stuff ***/

    You should be able to read the block of code there and figure it out.

    June 8, 2011 at 3:07 pm #33119
    g01010
    Member

    Okay, that’s done it. Thanks for your help.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ