I have my user badge setting, set to only show the top 2 user badges. But on my Author Pane in my forum, all badges are showing up. Also, in the admin area it is only showing the top 2 badges. This makes things difficult to assign/create rules, when you have to go back and forth to shut the "show top Badges" back off.

Author Pane - Show top badges does not work. Which is not ideal
Admin area - Show top badges does work. Which is not ideal for creating new rules, etc.

Comments

soup1977’s picture

no one else is having this issue?

darkdim’s picture

I have the same problem. In the setting is the number one badge, and the author pane few badges.

michelle’s picture

The code is hosted in AP but I neither use nor support it. The function it uses is user_badges_for_uid(). If there is a better function to use to respect this setting, patches are welcome.

Michelle

Numline1’s picture

It may be realted to error which occurs after setting max. badges number: http://drupal.org/node/964546

venusrising’s picture

I too have the issue where it is now show ALL badges when we only wanted it to show one which was working great prior to the update, does anyone know if there is new code to replace that has changed since prior?

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

@numline1: if it is related to #964546: $account->badges_all issue, then there is a simple fix over there to be tested.

@venusrising: do you mean the update from UB 1.5 to 1.6?

soup1977’s picture

http://drupal.org/node/964546 this is not related to this issue.

http://drupal.org/node/964546#comment-3771240 I tried this fix and The Author pane is still showing all badges regardless of setting. Maybe I need to put this issue on the Author Pane project page??

michelle’s picture

@soup1977: I already answered in #3. If you move it to AP's queue without a patch, it's just gonna sit there.

Michelle

soup1977’s picture

I wish I was savvy enough to provide a patch, but I'm not. That's why I'm looking for help. At some point maybe someone else will run into it and have the brains to fix it, until then I guess I'll create a view to use instead of using the Author Pane module.

venusrising’s picture

Has anyone had any luck getting this fixed? I rolled it back to prior version and it fixes the multiple badge display in user badges.

venusrising’s picture

Title: User Badges not showing correct number in Author Pane » User Badges not showing correct number in Author Pane-Please Help
Priority: Normal » Major

The code authorpane is using is

if ($account_id != 0) {
$variables['user_badges'] = user_badges_for_uid($account_id);
}

has this code changed in the most stable release of user badges? We have both of these running on a live site so we really need some info so we can roll to current user badges stable.
I can test on a dev site Nancy if you how this is being called has changed

ressa’s picture

The dev version from 2010-07-11 version = "6.x-1.x-dev" only shows one badge, if that is the setting of "Number of badges to display".

The latest dev version from 2010-Dec-11 shows all badges, on some pages, but not all.

nancydru’s picture

Yes, there was a change in that code to support the "No badges" message feature (#892996: If no badges are assigned display message saying that "No badges have been earned" or equiv). You can try setting that message to something and see if this becomes at least consistent.

EoinBailey’s picture

The quick fix to this is to edit out the following three lines:

if (isset($badges[$uid])) {
    return $badges[$uid];
}

These are found at line number 758 in the user_badges.module file - in function "user_badges_get_badges".

Removing this line forces the "user_badges_get_badges" function to check the limit again for that user (and every user in fact). I think the issue is a minor caching problem with the user badges module.

nancydru’s picture

That was done for #945280: Reduce queries which was a significant performance issue, so it would be better to find out why that seems to be messing you up.

venusrising’s picture

Status: Postponed (maintainer needs more info) » Active

If Authorpane uses uses is user_badges_for_uid() is this still the correct way to call User Badges per the User Badges update code? I tried to provide the code for AP I found in the module page but am not a coder but can test on a dev site if someone from user badges can suggest another way to call in the code to authorpane.

Wolfgang62’s picture

Any news on this one?
I removed the 3 lines code but doesn´t help. Still showing more than 1 badge.

Simon.Smithson’s picture

I'm also having the same issue on a production site. I've had a look through the code, and as far as I can see everything looks logical. Any bright ideas?

venusrising’s picture

I have scoured the code too and do not see any reason for the issue but can test if someone has any ideas.

soup1977’s picture

I've dug through what I could as well, and have found nothing. Obviously it is something, but I'm not sure what it could be.

nancydru’s picture

Title: User Badges not showing correct number in Author Pane-Please Help » User Badges not showing correct number in Author Pane

It's even harder for me since I don't have an Author Pane.

venusrising’s picture

Well if someone has an idea I am happy to test or paste code

LynnS’s picture

Subscribing. I'm not using AP and all badges are displaying even though I've specified one. This completely ruins the module for my use. I've had to turn the damn thing off. I switched to dev hoping it had been addressed, but no va.

michelle’s picture

@NancyDru: You don't need Author Pane. All I need to know is this: Given the UID of the viewer and the UID of the person with badges, what function will return the badges that the viewer should be seeing?

This is the code AP is using:

$variables['user_badges'] = user_badges_for_uid($account_id);

If that's not the correct function, what is? I'd be happy to change it but I don't use User Badges and am not going to go hunting through the code to find it. Either Nancy or someone who cares about using them together needs to dig in and tell me what function to use. Keep in mind that the result is printed as is in the template so, if it's a theme function that's needed, I need to know that one.

@LynnS: This issue is about the UB/AP integration. If you're having problems outside of AP, please start a new issue.

Michelle

venusrising’s picture

I upgrade to the new stable Author Pane and left User Badges at 6.x-1.5 (since we had to roll back when issues arised) and it works fine. Have not tried to re-up UB yet as the site is production and we are concerned about issues.

venusrising’s picture

Can someone from user Badges kindly comment on this? Please thanks

ressa’s picture

Have you tried digging up the dev version from 2010-07-11, "6.x-1.x-dev"? It only shows one badge, if that is the setting of "Number of badges to display".

venusrising’s picture

No because the prior stable release works so we just rolled back as the site is live

michelle’s picture

Status: Active » Closed (duplicate)

Someone put a patch over in my queue. If you want it to get in, please test: #1142226: user_badges variable show all badge instead of the right badge number set in the badge settings page

Michelle

venusrising’s picture

Michelle
Will give it a go tomorrow and see what happens.

venusrising’s picture

Status: Closed (duplicate) » Active

Michelle-
I did the patch and it solved the problem for us too.

michelle’s picture

Status: Active » Closed (duplicate)