WPBadger icon indicating copy to clipboard operation
WPBadger copied to clipboard

Wrong badge is being awarded

Open gyststarblayze opened this issue 12 years ago • 8 comments

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:

  1. I am able to publish the badge as expected.
  2. 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!")
  3. 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.
  4. When the recipient clicks on the Accept Badge link, the Mozilla confirmation popup dialogue appears, as expected.
  5. 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?

gyststarblayze avatar Feb 22 '13 16:02 gyststarblayze

I did not see this thread (should have looked first) but I am having the exact same problem.

jamesmichie avatar Mar 04 '13 20:03 jamesmichie

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!!!

Michaelboll avatar Mar 08 '13 05:03 Michaelboll

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 avatar Apr 12 '13 20:04 jiripavlicek

@jiripavlicek Wow, that worked like a charm. Absolutely beautiful. Thanks!!

gyststarblayze avatar Apr 15 '13 14:04 gyststarblayze

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.

jonbounds avatar Jun 04 '13 10:06 jonbounds

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.

jonbounds avatar Jun 04 '13 11:06 jonbounds

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......

PeggySen avatar Aug 30 '13 12:08 PeggySen

@jiripavlicek Thanks--worked for me also.

WBKitty avatar Sep 19 '13 01:09 WBKitty