Before

function balance_tracker_user($op, &$edit, &$account, $category = NULL) {
  global $user;
  if ($op == 'view' && variable_get('balance_tracker_show_in_profile', 'noshow') == 'show') {
    if (($account->uid == $user->uid && user_access('view_own_balance')) || user_access('view all balances')) {
      $balance = balance_tracker_format_currency(balance_tracker_get_balance($account->uid));
      $value = $balance .'<p>'. l(t('View full balance sheet'), 'user/'. $account->uid .'/balance') .'</p>';
      $account->content['user_balance'] = array(
        '#type' => 'user_profile_category',
        '#title' => t('Balance'),
        '#weight' => 4,
      );
      $account->content['user_balance']['balance'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('Current Balance'),
        '#value' => $value,
      );
    }
  }
}

After

function balance_tracker_user($op, &$edit, &$account, $category = NULL) {
  global $user;
  if ($op == 'view' && variable_get('balance_tracker_show_in_profile', 'noshow') == 'show') {
    if (($account->uid == $user->uid && user_access('view own balance')) || user_access('view all balances')) { // patch glu2006
      $balance = balance_tracker_format_currency(balance_tracker_get_balance($account->uid));
      if (!user_access('view own balance')) {
        $path = 'user/'. $account->uid .'/balance';
      }
      else {
        $path = 'balance';      
      }
      $value = $balance .'<p>'. l(t('View full balance sheet'), $path) .'</p>';      
      $account->content['user_balance'] = array(
        '#type' => 'user_profile_category',
        '#title' => t('Balance'),
        '#weight' => 4,
      );
      $account->content['user_balance']['balance'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('Current Balance'),
        '#value' => $value,
      );
    }
  }
}

Sorry that did not take the form of a patch. Good luck.

Comments

glu2006’s picture

Probably wise to this:

if (user_access('view own balance') && !user_access('view all balances')) {
  $path = 'balance';
}
else {
  $path = 'user/'. $account->uid .'/balance';      
}
brianV’s picture

Status: Active » Fixed

Committed, will be in the 6.x-1.8 release I am putting out shortly.

#679824 by glu2006: Fixed Not correctly displayed links and information about the balance in the user profile.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alechko’s picture

same bug in the version = "7.x-1.x-dev"

126: if (($account->uid == $user->uid && user_access('view_own_balance')) || user_access('view all balances')) {...

is wrong, showing no balance at the user profile

126: if (($account->uid == $user->uid && user_access('view own balance')) || user_access('view all balances')) {...

is correct.

soheilstar’s picture

Version: 6.x-1.6 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I do but not displayed balance in the user profile page!!!

Does anyone have a solution?

sergeypavlenko’s picture

Status: Active » Patch (to be ported)

Thank you for alechko solution! Committed ( 3ac311b ) to 7.x-1.x-dev.
Thank soheilstar for testing, bug has been fixed in version 7.x-1.x-dev, and now the balance is displayed on the user page. Commit 6ece0ba.

sergeypavlenko’s picture

Status: Patch (to be ported) » Fixed

Changed status.

Status: Fixed » Closed (fixed)
Issue tags: -Balance Tracker

Automatically closed -- issue fixed for 2 weeks with no activity.