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
Comment #1
glu2006 commentedProbably wise to this:
Comment #2
brianV commentedCommitted, 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.
Comment #4
alechko commentedsame 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.
Comment #5
soheilstar commentedI do but not displayed balance in the user profile page!!!
Does anyone have a solution?
Comment #6
sergeypavlenko commentedThank 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.
Comment #7
sergeypavlenko commentedChanged status.