• Resolved mrpcameron269

    (@mrpcameron269)


    I haven’t been able to find a tutorial for replacing a badge after one is earned, and it seems like this should be a fairly easy thing to do and implement, but I can’t figure it out.

    Ideally, what I’m looking to do is award tiered badges. So if someone completes 2 out of 4 lessons, they earn the copper badge. If they complete 3 out of 4 lessons, I want to replace the copper badge with a silver badge. If they complete all 4 lessons out of 4, I want to replace the silver badge with a gold badge. At any given time, they will only have one of these badges awarded to them so if they have the silver badge, they can no longer have (or see) the copper badge. Can you give me some instructions or point me to a document that will help me set this up? Or a process to automatically revoke a badge based on conditions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mrpcameron269

    (@mrpcameron269)

    Anyone have a lead on this?

    Plugin Contributor Wooninjas

    (@wooninjas)

    Hi @mrpcameron269

    So you want the previous badges to be revoked automatically whenever user earns a new badge? well, Badgeos does not offer such functionality. However, you can get your desired functionality using below action hook

    function your_function_name( $user_id, $achievement_id, $this_trigger, $site_id, $args ) {
      // Your stuff
    }
    add_action( 'badgeos_award_achievement', 'your_function_name', 100, 5 );
    Plugin Contributor Wooninjas

    (@wooninjas)

    Please add a review here for us.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Replacing / Swapping Badges Earned’ is closed to new replies.