WPBadger
WPBadger copied to clipboard
Wrong badge is being awarded
I'm having a strange error where the incorrect badge is being awarded. Twenty days ago (Feb 2) I issued a badge and everything worked properly. Then, today (Feb 22) I issued a badge and things started acting strangely. Specifically:
- I am able to publish the badge as expected.
- The email arrives in the recipient's inbox, as expected. The subject of this email indicates the proper badge. ("Congratulations, You have been awarded the [Badge Name] badge!")
- When the recipients click the link, they are redirected to the Wordpress page that allows them to Accept or Decline the badge. The title of this page reflects the proper badge title. So far, so good.
- When the recipient clicks on the Accept Badge link, the Mozilla confirmation popup dialogue appears, as expected.
- However, after the recipient clicks the blue "Cool, let's go" button the problem appears. The wrong badge is displayed for acceptance. The image, name, description, etc. of the badge all match a DIFFERENT badge that—not the one that was issued.
I've tested this using several different badges and several different recipients. Each time the same incorrect badge is displayed. Incidentally, the incorrect badge is the badge I created most recently, which also happens to the be the last in alphabetical order (I suspect the timing matters more than the alphabetical order).
I did not update Wordpress or any plugins during the past twenty days, so I'm stumped. Any thoughts?
I did not see this thread (should have looked first) but I am having the exact same problem.
I am totally have the same problem too! It always pulls up the most recent badge uploaded. It ignores that you have requested a different one.
Anybody know a solution?
Thanks!!!
Hi all! I have the exact same problem. Bug is in the file /wpbadger/includes/awards_json.php in WP_Query arguments. Author lookups badge by the $title and $version and it doesn't work right.
My solution is replace code (/wpbadger/includes/awards_json.php):
$badge_query = new WP_Query(array( 'post_status' => 'publish', 'post_type' => 'badge', 'post_title' => $title, 'meta_query' => array( array( 'key' => 'wpbadger-badge-version', 'value' => $version, 'compare' => '=', 'type' => 'CHAR' ) ) ) );
by this code (/wpbadger/includes/awards_json.php):
$badge_query = new WP_Query(array( 'p' => $chosen_badge_id, 'post_type' => 'any' ) );
Enjoy!
@jiripavlicek Wow, that worked like a charm. Absolutely beautiful. Thanks!!
I'm having the same problem - but if I apply @jiripavlicek's fix I get:
"We have encountered the following problem: Could not parse the undefined file at undefined file"
from Mozilla Backpack.
This may have been an unrelated issue where HTML in the badge description of the one I wanted to award was throwing this error. Not totally sure.
Hello, i found out during testing that the wrong badge is awarded, when the Badges have the same Description. Always the newest with the same Description is taken as Criteria. I don't know if this should be, its a little bit annoying. Also its annoying that the "Choose Badge" List in the Awarding Section only shows the last 10! i really need many Badges in my Backpack for Testing......
@jiripavlicek Thanks--worked for me also.