Note: This is to inform you that these snippets are around 2 years old so these might not work for everyone.

Custom Hook: LearnDash

Home / Code Snippets / Custom Hook: LearnDash

Award / Deduct points for completing a Course, Lesson, Topic, or Quiz.

Add this code snippet to your functions.php file.

    1. Thanks for the code. I want to know if they released the official addon Leardash and MyCred.

  1. How can I add these hooks to it so it has the same features of the BadgeOS add-on?

    Complete a specific Course
    Complete a course from a specific Tag

    Pass a specific Quiz
    Achieve a minimum percent grade on a specific Quiz
    Achieve a minimum percent grade on any Quiz
    Fail a Quiz (i.e. useful for rewarding the passing of a previously failed quiz)

    Complete a specific Lesson

  2. Hey guys,

    I just wanted to let you know that I’m currently working on turning this into a full-fledged myCRED for LearnDash plugin. @Austin, I actually do plan to include some of the features of the BadgeOS add-on. Especially the ability to award/deduct points for getting a specific score on a Quiz.

    I should have the initial release finished some time this week, so you can come check it out on when it’s ready.


    1. I was just about to make one until I read you were already working on it. Are you finished with it, or do you need any testers or help?

    2. @Christain Freeman,
      Have you made any progress with this? It looks like as of myCred 1.7 this is no longer working (at least for me). I wasn’t able to fund the development of this, but I would be more than happy to buy yours if you got this working.

  3. If you add:
    Complete a specific Course
    Pass a specific Quiz
    Achieve a minimum percent grade on a specific Quiz

    I’ll buy it! 🙂

    One other that thats not included with BOS:

    Complete a Quiz from a specific Category.


  4. Mr Christian Freeman I hope your paypal account is ready! Good job Dude. So many Learndash users like me do not want to go near that BadgeOS code to infect our WordPress installs.

  5. Tried adding this code again to Functions.php file in directory includes at the very end of the large file. and it just doesn’t like it.
    Fatal error: Call to undefined function add_filter() in /home/eqsiq/public_html/wp-includes/functions.php

    If anyone can advise me what I am doing wrong I would be most grateful.

  6. What is the status of this function? Is there a way to award credits to users for LearnDash activities? If I need to use the code snippet above to achieve this functionality; what exactly would be the outcome of adding this code snippet? Would this assign a fixed point amount per course completed? Or does this add a hook to MyCred to allow me to specific point allocation via wordpress admin? I am trying to figure out where I would manage the allocation of points using this snippet…It looks as if I would need to set a fixed amount for all quizzes and actions in the actual snippet itself?

  7. Hey guys! I got tired of waiting so I’ve hired the main programmers that works with LearnDash to create this myCRED addon. Check out the kickstarter on how you can help get this rolling. All the money raised on the kickstarter will go to adding new features and hooks. The benefits to backing will be unlimited upgrades and a discount. If the goal doesn’t get met, you won’t be charged a think. 🙂

    With your help we can make LearnDash and myCRED fall in love and make beautiful points together.

Leave a Reply