Advertisement:

Author Topic: [SOLVED] payment pro plugin (Display user wallet credit on user dashboard)  (Read 654 times)

ezybusy

  • Full Member
  • ***
  • Posts: 193
Hi everyone,
i am using the plugin Payment pro on my website. I have turned on the option Allow users's wallets which is the only payment option for my website to allow users to set their ads as premium.

Now i want to display users credit balance on the user dashboard, so that they can have a constant look at their credit balance anytime they log into their account. Something similar to the following:
- You have $100 of premium credit into your account. (To display if the user has credit)
- Insufficient premium credit, contact the admin to load your account.  (To display in case the user credit is 0).

I contacted the support team for the plugin regarding the above, and got the following answer:

You could use the following code to display user's credit:
Code: [Select]
$wallet = ModelPaymentPro::newInstance()->getWallet(osc_logged_user_id());
    if(isset($wallet['i_amount']) && $wallet['i_amount']>0) {
        $credit_msg = sprintf(__('Your current credit is %s', 'payment_pro'), osc_format_price($wallet['i_amount'], osc_get_preference('currency', 'payment_pro')));
    } else {
        $credit_msg = __('Your wallet is empty. Buy some credits.', 'payment_pro');
    }
[/b]

Then i tried inserting the above code on the user-dashboard.php page as a php code (in between <?php and ?>) but got an error.
Upon contacting the support team to let them know about the error, i was told the following:
You need to later print/echo the $credit_msg variable to display the text.

However i don't know how to do the above. Can someone help me out?

regards,
« Last Edit: June 04, 2016, 01:09:54 pm by ezybusy »

Abhi

  • Jr. Member
  • **
  • Posts: 78
  • Love what you do :)
Just use this <?php echo $credit_msg; ?> use this where ever you want to display user credit