• Resolved alikarkary

    (@alikarkary)


    first at all , thanks alot for this plugins and i so happy to using it ,

    i want add to user +40 score if winner per quiz how can i do that ?

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

    (@alikarkary)

    this my code

    $user_gems =get_user_meta(get_current_user_id(),’score’,true);
    update_user_meta(get_current_user_id(),’score’,$user_gems+’45’);

    Plugin Author Codevery LLC

    (@codevery)

    Hello @alikarkary ,

    Thank you for your kind words! We’re delighted to hear that you’re enjoying our plugin.

    Currently, there is no way to add custom code for awarding points when a user wins a quiz, as the plugin does not have the necessary hooks. However, we understand the importance of this feature and are planning to add hooks in our next release.

    If this is urgent, you can temporarily add the code directly to the plugin file wp-content/plugins/codevery-quiz/includes/public/class-codevery-quiz-public.php
    to the add_coupon_to_database() function before the line if ( ! class_exists( 'WC_Coupon' ) ) {. The code will look something like this:

    public function add_coupon_to_database() {
    if ( ! check_ajax_referer( 'cquiz_display', 'cquiz_display_nonce', false ) ) {
    wp_send_json_error( 'bad_nonce', 400 );
    }

    if ( is_user_logged_in() ) {
    $user_id = get_current_user_id();
    $user_gems = get_user_meta( $user_id,'score', true );
    update_user_meta( $user_id, 'score', $user_gems + 45 );
    }


    if ( ! class_exists( 'WC_Coupon' ) ) {
    return false;
    }

    We appreciate your patience and understanding. If you have any other questions or need further assistance, please don’t hesitate to reach out.

    Best regards,
    Codevery LLC

    Thread Starter alikarkary

    (@alikarkary)

    So many Thanks Codevery LLC? <3 its best way for me ????

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how can i check condition’ is closed to new replies.