I have installed latest 6.x-1.x-dev version of user badges on my test website. I am facing these problems with the user badges. Don't know might be a bug.
1. Even after limiting the number of badges to 1 (in settings) it shows all the badges to the user.
I temporarily fixed this issue by adding $limit = 1; on line 832 just after
// Should we limit the badges returned?
if (!$options['nolimit'] && variable_get('user_badges_showone', 0)) {
$limit = variable_get('user_badges_showone', 1);
}
else {
// Set to -1 for no limit.
$limit = -1;
}
in user_badges.module file.
2. Whenever i create a new user in the system, following warning are thrown:
warning: key_exists() [function.key-exists]: The first argument should be either a string or an integer in /var/www/html/..../sites/all/modules/user_badges/user_badges.module on line 245.
warning: Illegal offset type in /var/www/html/..../sites/all/modules/user_badges/user_badges.module on line 248.
And the default badges is not assigned to the new user instead the badge with the lowest weight is being assigned.
Comments
Comment #1
nancydruThat code and that error message tell me that either you don't have the latest code or I screwed up the commit. I have made several fixes lately. However, I am not sure the badge limit code is right yet because the issues on that haven't been specific enough for me to be sure I've fixed it. For example, where, exactly, does it "shows all the badges to the user" that you expect it not to. Please search the issue queue and respond in the appropriate existing issues.
Comment #2
geekashu commentedI am using the latest Development release dated 18th Feb, 2011. If i remove the code
$limit =1;from the issue 1 all the badges are being shown in my author pane as well as badges tab.Any thoughts on issue 2?
Comment #3
geekashu commentedI rolled back to the earlier CVS build (Before 18th Feb). Issue number two got fixed without doing anything. Now to fix the badge limit issue i added the code as i have described in #1 issue-1. All done, i created a new user and encountered this warning.
warning: key_exists() [function.key-exists]: The second argument should be either an array or an object in /var/www/html/..../sites/all/modules/user_badges/user_badges.module on line 246.On examining line 246 i found this piece code and done a little tweak to fix the warning.
to
Now every thing is working fine as it should be.
Comment #4
Miria commented#3 did it! Badges are finally displaying correctly in author pane for the first time in forgot how long. Thank you. :)
Comment #6
afox commentedHi,
the proposed fix in #1 is a hack which basically hardcodes a 1-badge limit to the module. The real problem lies in the user_badges_user -hook. It worked (and was a bit cleaner :) ) in the latest stable, but ongoing development has made some quirks to the code.
This is why you really should not use dev-code in a production environment. Dev-code REALLY is in development.
I've attached the patch which correct this behavior in user/profile.
Comment #7
shabana.navas commentedFixed in Version 7. Please upgrade to Version 7.x-3.x.