2 issues here,
1st issue:
warning: Invalid argument supplied for foreach() in user_badges.module on line 191. when used with "my account alter".
$account->badges does not exist when user_badges is accessed from the admin section
Solution: add a check to see if it is an array - if not, then do not do the foreach.
2nd issue:
As there are no badges to view, the code does not return any response (i.e. blank), therefore the "my account alter" module is unable to display a configuration option for this.
Solution: include some code to return a message, i.e. "No badges available" in the user_badges_user view op when there are no badges to display. This will have the double effect that if the user doesn not have any badges they are informed as such, and any module that expects / needs some content from this function will get it.
Comments
Comment #1
nancydruDrupal issue tracking cannot handle multiple items in a single node, especially when one is a bug report and the other is a feature request. Since #2 appears to be a duplicate of #728048: 'Badges' tab in user profile results in empty page and/or #892996: If no badges are assigned display message saying that "No badges have been earned" or equiv, I have changed the title.
I have no idea what "my account alter" means. Is that a module? If so, linking to it would be a help. Your solution is really not generally a good idea as it only masks the real problem of why the array is empty or not an array to start with.
Comment #2
nancydruMyAccount_Alter is not being maintained. I'm guessing that #728048: 'Badges' tab in user profile results in empty page has fixed this. Please test with the latest -dev version. If it is not fixed, please re-open this issue.
Comment #3
nancydruactually, duplicate.