WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have modified an old Stackoverflow inspired badge system script to work with the latest Wordpress version. You can view the code here (and please feel free to use it if you wish): http://pastebin.com/zA4zGnKZ

It has a condition system that detects Post tags, Post count and Comment count. You can create custom badges and assign conditions to them. It works perfectly besides a very random bug that I cannot fix.

I setup a Wordpress test site and created 10 accounts. I played around with the users and the badges were awarded according to its conditions, so for instance, if a user posted 10 articles, they would be awarded the Junior Publisher badge.

However, one user was instantly awarded all badges when the account was created. This user has no posts or comments. Even more strange, when I add a new badge, this user automatically gets awarded with it! There is no difference between this user and the other users. All have Contributor privileges. The user ID number of this user is 5.

Can you please help me detect why the script is behaving like this? Obviously, I cannot add the script to a live site yet in scare of random users being awarded all badges like this user.

share|improve this question
Github gist version of this plugin can be viewed here. It has syntax highlighting and no ads :) – Giri Nov 2 '12 at 23:55
Thank you. Although I was not aware that pastebin has ads - thanks to ad blocker. – Amanda Duke Nov 3 '12 at 0:32
up vote 2 down vote accepted

On line 704 it mentions something about "User_ID => 5". Not sure, but this might have something to do with your problem?

    // debug shit
    $args = array('user_ID' => 5);
    rhb_check_user_badges( $args );
share|improve this answer
Yes it is, sorry I solved this issue for days ago. Thank you though. Answer accepted :) – Amanda Duke Nov 13 '12 at 11:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.