Manual Badges

Home / Code Snippets / Manual Badges

By default, myCRED will give users a badge automatically based on your setup. This snippet will allow you to create badges that will never be automatically awarded to users. These manual badges would need to be added manually by editing the user in the admin area.

Add to your child theme's functions.php file and create badges in the admin area using the reference "Badge is awarded manually".

    1. Sure, you can just use add_user_meta to add the badge to the user:

      $user_id = 2;
      $badge_id = 1;
      $badge_level = 0; // zero for first level
      add_user_meta( $user_id, 'mycred_badge' . $badge_id, $badge_level, true );
      

      You will need to set the custom user meta’s value to the level you want to award. Use zero if you just have one level or if you want to award the first level.

Leave a Reply

Spin to win points 💰
Kindly get back to your previous orientation view... your wheel is rolling there...

Do you really like this awesome addon and wanna use on your site? click here to get it now 👍
myCRED Fortune Wheel special offer unlocked!
You have a chance to win free tokens. Are you feeling lucky? Give it a spin.
* You can spin the wheel only once in a month.
* You can spin again any time by paying 500 points
* Once you pay for spin you are not able to refund it.
You must login to play mycred fortune wheel
11
Happy HolidaysGET DISCOUNT