I got an unexpected error each time i try to access the badge list.
Error log shows :
Recoverable fatal error : Argument 1 passed to drupal_http_build_query() must be an array, string given, called in /XXX/XXX/www/includes/common.inc on line 2222 and defined dans drupal_http_build_query() (ligne 486 dans /XXX/XXX/www/includes/common.inc).
preceded by three occurences of :
Notice : Undefined variable: account dans theme_user_badge() (ligne 1237 dans /XXX/XXX/www/sites/all/modules/user_badges/user_badges.module).
Line 1237 of the file user_badges.module looks this way :
$href = token_replace($href, array('userbadge' => $badge, 'user' => $account));
full file attached to the issue.
Error occurred just after i added a new badge. I can still access to the tabs image, roles, and settings, though the autocomplete on badges causes HTTP AJAX 500 error, but only if the last badge i added is supposed to appear in the completion (other completions works just fine).
So i guess the problem is linked to the last badge i added. Is there also a way to delete this specific badge manually (without using the badge list which is broken due to this issue) ?
NB: i use drupal 7.23
Comments
Comment #1
SdG ct CreditAttribution: SdG ct commentedI was able to identify the problem source.
It came from the last badge i created which included a link to an external URL in its description, and i solved it by modifying manually the badge entry in the db.
drupaluser_badges_badges, and setting href field to NULL for the concerned badge.
NB : Before doing that, I tried replacing my module version (7.x-1.0) with the 7.x-3.x-dev, which didn't solved the problem, so i assume the 7.x-3.x-dev version is also concerned by the issue and changed the module version of this post accordingly.
Comment #2
shabana.navas CreditAttribution: shabana.navas commentedI have tried to replicate this issue by adding a link to the description url, but I am not getting any errors as you have suggested. I have included a screen shot of the badge I tried to add. Let me know if you are doing anything differently.
Comment #3
SdG ct CreditAttribution: SdG ct commentedThanks for the answer.
I did upload my own image instead of using and image URL, and the link i used was external (can't see on screenshot if you tested directly on drupal.org or not). apart from that i'm not sure what could have messed things up, i think it has to do with the description link since everything started working again when i removed it into the db. I'll do more testing on my side and try to reproduce the error, I'll keep you informed.
Comment #4
SdG ct CreditAttribution: SdG ct commentedFound it !
Just use a link containing a GET request :
https://www.google.fr/?q=test
It caused the issue every time.
Comment #5
shabana.navas CreditAttribution: shabana.navas commentedPatch for the 7.x-3.x-dev version is submitted below. Please test it out.
Comment #6
SdG ct CreditAttribution: SdG ct commentedThe patch seems to work perfectly fine for me.
I wasn't sure about the status i should give to this post so i didn't changed it.
Comment #7
jlandfried CreditAttribution: jlandfried commentedWe can use drupal_get_query_array to do this for us :-)
Comment #8
jlandfried CreditAttribution: jlandfried commentedWhoops, that last patch threw a notice when the url didn't have query parameters, this one should fix that
Comment #9
shabana.navas CreditAttribution: shabana.navas commentedAwesome! I knew there was a Drupally way of getting this done. @jiff: Thanks, really appreciate it. Will test it out and if everything works out okay, will commit it to the dev version.
Comment #10
shabana.navas CreditAttribution: shabana.navas commentedCommitted to 7.x-3.x version.