Support » Plugin: Achievements for WordPress » Award achievements and generate pop up

  • Resolved Frix00



    First of all, let me say thanks for a great plugin. I hope this plugin goes from strength to strength and the supported plugin list continues to grow.

    We’re building a sort of quizzing site with lots of different quizzes. To cut a long story short, we didn’t want / couldn’t use Courseware for it, so we need to find a way to award achievements to our users completing the quizzes “manually”.
    I’d like to write a piece of php/javascript that executes when the user successfully passes a quiz. This should basically award him the achievement relating to this quiz (we’ll create 1 achievement per quiz) and also display the achievement pop up.

    Would you be able to point me in the right direction here ? What set of functions would be suitable to use here ?

    Happy to do some trial and error myself, but just thought I’d ask for some pointers.



Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi

    Reading further into the plugin, it seems like the heartbeat function would actually do the job of creating the pop up to a user having been awarded a new badge, so presumably all I need to do is find a way to “manually” grant a badge to a logged in user via ajax/php upon completion of a quiz.
    Am I right in the assumption that the below chain would work:
    1. User creates a quiz
    2. My code grants an achievement to this user (that’s the bit I need to figure out)
    3. The heartbeat code “detects” that the user has a new achievement and display the overlay

    If you could point me to the right php function that right help me award an achievement to a user, that would be great !

    Many thanks

    Plugin Author Paul Gibbs


    Hi Greg

    Absolutely. Let me write up some docs this weekend because I’ve promised at least one other person, and I’ll do a better job spending a few hours writing up a document rather than spending 10 minutes on a quick forum reply.

    In terms of what your quiz code needs to do, it’s literally something like this.

    do_action('greg_is_cool', $user_id);

    Assuming you’re familiar with WordPress actions and filters, you can call the action whatever you want, and for ease of integration with Achievements, pass a user ID as the first parameter.

    You’ll only want to call your new action(s) whenever you’ve verified that the quiz was validated and completed successfully.

    Many thanks Paul.

    I see exactly what you mean, and yes a little bit of documentation would be fantastic, so please do let me know when you’ve had a chance to do it and post it online.

    I can then crack on with writing a little plugin that will check the quiz result, and grant the achievement if need be.

    Really appreciate thee help, thanks !


    Plugin Author Paul Gibbs


    The documentation page for this is coming along well. I’ve written up a bunch of words, and next is working on a sample plugin that people can use a base for adding custom extensions to for Achievements. I might be able to work on that tomorrow night.

    Plugin Author Paul Gibbs


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Award achievements and generate pop up’ is closed to new replies.