How to get the question tags from a question?

Home Forums Legacy Support Support queries Update Issues How to get the question tags from a question?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #338637
    arteebee
    Participant
    1) https://prntscr.com/ynzast My question is how can we get the question tag from the question itself? 2) https://prntscr.com/yaubud This screenshot is from the quiz result page, and I want to ask how did you get the correct percentage for each question tag that appears during the quiz? My final goal is to set up comments based on the correct percentage of question tags. Same as the second screenshot I provided, if the student gets all the "Animal" questions correct, then the percentage is 100% and I will give a comment as "Animal 100% correct!!". Can you please help me with this? Thank you.
    #338644
    arteebee
    Participant
    This reply has been marked as private.
    #338655
    arteebee
    Participant
    This reply has been marked as private.
    #338797
    Anshuman Sahu
    Keymaster
    This reply has been marked as private.
    #338829
    arteebee
    Participant
    Hi Alex, I tried to get the question tag value in/after the quiz evaluation. More specifically, I used a hook function as ' add_action('wplms_after_quiz_message', 'my_custom_function'); ', and I expect to display the correct percentage of each question tag as a text variable. I circled a place where I want to put my result of the question tag's correct percentage: https://prntscr.com/yqtu9k I really appreciate your reply. Best Wish.
    #338846
    MrVibe
    Keymaster
    Enable WP admin - LMS - Settings - Advance quiz stats. --- Not exactly sure what you want to achieve. 1. Question tag is a taxonomy for the question. 2. Each question tag term maintains the correct and incorrect data in Term meta. ---
    #338847
    arteebee
    Participant
    Hello, I already enabled the Advance quiz stats, that's why I want to know more about it. My customer wants me to create different comments based on the correct percentage of a question tag. To be more specific, I will use this screenshot as an example: https://prntscr.com/yaubud. In this screenshot, it includes these question tags and their correct percentage: ( Number: 0%, Animals: 100%, Capitals: 100%, Geography: 100%, Roman: 0% ). So what my customer wants me to do is: if(Number's correct percentage > 50%){ echo 'Number's correct percentage is greater than 50%'; }else{ echo 'Number's correct percentage is less than 50%'; } This is basically what I want. If you can provide me with a possible solution would be great. Thank you.
    #339017
    Anshuman Sahu
    Keymaster
    here is the function which can return tags data : you just need to pass quiz id and user id :
    function get_tags_data($quiz_id,$user_id){
    
    	$tags_data =  get_user_meta($user_id,'tags_data'.$quiz_id,true);
    	return $tags_data;
    	
    }
    #339040
    arteebee
    Participant
    Thank you so much, this is the exact function I need. You can close this topic now.
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘How to get the question tags from a question?’ is closed to new replies.