Skip to:
Content
Pages
Categories
Search
Top
Bottom

Quiz plugins & Achievements

  • Avatar of doclalor
    doclalor
    Participant

    @doclalor

    I’d like to set up a quiz plugin (probably WP-Pro-Quiz v0.4, or maybe SS Quiz) to report the quiz’s final point value to Achievements. I’m looking at http://achievementsapp.com/developer/add-support-for-a-plugin-non-custom-post-type/.

    1. Suppose I add a new record to my achievements_actions database as follows: category = “WPquiz”; is_group_action = “0”; name = “took_quiz”.
    2. Would I insert the do_action call, `do_action( ‘took_quiz’, $to_user_id, $from_user_id );`, into wp-content/plugins/wp-pro-quiz/lib/view/WpProQuiz_View_FrontQuiz.php around line 58?
    3. And then in the theme’s functions.php?:
    `function dpa_handle_action_took_quiz() {
    $func_get_args = func_get_args();
    dpa_handle_action( ‘took_quiz’, $func_get_args );
    }

    function myplugin_set_action_category_name( $category_name, $category ) {
    if ( __( ‘Other’, ‘dpa’ ) == $category_name && ‘WPquiz’ == $category )
    return __( “?????????”, ‘WPquiz’ );
    else
    return $category_name;
    }
    add_filter( ‘dpa_get_addedit_action_descriptions_category_name’, ‘myplugin_set_action_category_name’, 10, 2 );`

    Thanks for advice you can offer to start me off!
    ~Brendan

    P.S.: I need to set this up so that a given quiz is only counted ONCE (although I’d like the quiz to be repeatable indefinitely).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    I’ve not looked at WpProQuiz_View_FrontQuiz.php, but as long as the do_action is used whenever you want the achievement to be granted, it should work fine.

    The above looks like a good start. Doesn’t it work?

    Avatar of doclalor
    doclalor
    Participant

    @doclalor

    Thanks SO MUCH for your response. No, this doesn’t work, at least due to my functions.php code:
    function dpa_handle_action_took_quiz() {
    $func_get_args = func_get_args();
    dpa_handle_action( 'took_quiz', $func_get_args );
    }

    function myplugin_set_action_category_name( $category_name, $category ) {
    if ( __( 'Other', 'dpa' ) == $category_name && 'WPquiz' == $category )
    return __( "1", 'WPquiz' );
    else
    return $category_name;
    }
    add_filter( 'dpa_get_addedit_action_descriptions_category_name', 'myplugin_set_action_category_name', 10, 2 );

    Avatar of doclalor
    doclalor
    Participant

    @doclalor

    Guidance appreciated!

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    I need to test something for someone else; hopefully they’ll reply to me by tomorrow or so, and then I’ll look at this at the same time. Time for sleep now :)

Viewing 4 replies - 1 through 4 (of 4 total)

The forum ‘Achievements’ is closed to new topics and replies.