Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When trying to alter the badges I get the following message:
"Admin (Badge ID 1)" is not a valid badge name. Try using the autocomplete function (requires javascript).
I've tried all kind of combinations, but it doesn't except the badge-role assignment. I've tried to use the autocomplete function, to use "Admin", "Badge ID 1" but nothing seems to work... anyone who has the same problem? It's a clean install...
Comments
Comment #1
NeoID CreditAttribution: NeoID commentedIs it just me having this issue?
Comment #2
NancyDruI have added badges.
Comment #3
NeoID CreditAttribution: NeoID commentedIf no one else has this problem... any idea what may produce such error?
I'm barely using custom code and mostly use well known modules... so there has to be some kind of incomparability somewhere.
Comment #4
NancyDruAre you seeing any errors in dblog or Apache?
Comment #5
NeoID CreditAttribution: NeoID commentedNo, only the errors on the actual page...
Comment #6
NancyDruIs #947172: Private download setting the problem? Otherwise, try the most recent -dev version and see if it works now.
Comment #7
NeoID CreditAttribution: NeoID commentedNancyDru: No
Besides, this is still an issue in the latest dev, this is critical in order to make use of the module...
Image: http://i.imgur.com/JZk0F.png
Comment #8
torgosPizzaThis error is being thrown due to this code returning false:
where $value is the value from the autocomplete field. Since "Badge ID" is the expression it's trying to match, it makes me wonder if there's some way Badge ID is being translated that is causing the match to fail? I noticed that your site has some non-English text in it, which is why I'm suspecting that it's a translating issue. If you have translated the string "Badge ID" somewhere, maybe it needs to be reverted? Or vice-versa, perhaps the string needs to be translated?
That's my best guess but hopefully this will point you in the right direction.
Comment #9
NeoID CreditAttribution: NeoID commented@torgosPizza:
Wow, you are right! I've tried a lot of things today, but I would never have guessed that to be the problem (since it's wrapped inside the t()).
Thanks, this fixed at least my problem, but maybe the string should not be translatable in the first place then? :)
Comment #10
NancyDruWhen I looked at your image, I wondered the same thing. Glad you verified that problem.
I know that if I removed the t() function, someone else would scream for it to be put back. I'll have to look at the code when I get home and see if the autocomplete is not using t().
Another possibility is to just not show the "Badge ID" stuff at all - just the badge name. That could be a performance improvement because preg_match is not very fast.
Comment #11
torgosPizza+1 for the solution in #10 "not show the Badge ID". I would perhaps do it the same way the autocomplete nodereference field works, that is Title followed by "[nid: 1234]". That way if you need to, you can extract the nid (or in this case, bid) and not worry about having to translate a string.
EDIT: I think I found the issue, as you suspected it looks like the value being returned by autocomplete is not actually translating the right string:
The string wrapped in t() is "(Badge ID" and it should actually be just "Badge ID". The parentheses should be moved to the outside, I think, so that it's just the text without punctuation, which is what preg_match is searching for:
if (preg_match('/\('. t('Badge ID') .' (\d+)\)/', $value, $matches)) {
.I would provide a patch but it's an easy fix, and also, I'm just looking at the source code in the CVS repo... I don't actually use this module yet. :)
Comment #12
NancyDruThat would do it. Thanks for checking. I'm dealing with RealLife™ right now.
Comment #13
NancyDruCommitted to 6.x-1.x-dev.
Comment #15
gorillaz.f CreditAttribution: gorillaz.f commentedA bad news as i've update user-badges to latest 6.x-1.x-dev, I still got error message when i try to assign badge to a user
Comment #16
gorillaz.f CreditAttribution: gorillaz.f commentedhow can I help to figure out the problem ?
Comment #17
gorillaz.f CreditAttribution: gorillaz.f commentedkind of amazing~ it works fine after my lunch ...
Comment #18
NancyDruIt was a good lunch then. Is it possible that the caches got cleared or something like that?
Comment #19
gorillaz.f CreditAttribution: gorillaz.f commentedActually, I've clean cache data before my lunch and taken a test, but it still failed. Then I went for lunch and after that it goes fine...
Comment #20
NancyDruWierd. It's hard to fix something that goes away mysteriously. Do you have an op-code cache that maybe took some time to update?