How to programmatically access the "current quiz question" related information from within the quiz module?

Events happening in the community are now at Drupal community events on www.drupal.org.
bangalos's picture

Hello everyone,

I am trying to create a LIFELINE feature for the quiz. For starters, it will display live twitter feed related to current quiz topic. I am using Quiz 4 module. I have created a new question_type, that will allow adding extra fields and store additional fields information in a separate table.

I would like to grab the current quiz question text, perform a search and display its results in a block. Which variable / function should I call so that I get the text of current question? I already have the block that will perform a twitter search and display the answers (twitter_pull).

Regards,
Srikanth.

Comments

menu_get_object() is the answer

sivaji_ganesh_jojodae's picture

I would like to grab the current quiz question text, perform a search and display its results in a block. Which variable / function should I call so that I get the text of current question?

call $result = menu_get_object() in your hook_block() $result->body will give you the question text.

bangalos's picture

Thanks Sivaji for the pointer. The menu_get_object function returned the quiz node information, not the quiz_question being taken. I am trying to update a module while quiz is being taken ... so */take pages have this Block enabled on them. $result->body content is always the same for all the questions - namely, the body for the quiz itself.

Is there a way to get the current quiz question in a separate module, without modifying the quiz.module file?

Thanks much,
Srikanth.

aha i misunderstood your

sivaji_ganesh_jojodae's picture

aha i misunderstood your question, please take a look quiz_take_quiz()*, its the primary function responsible for handling quiz. It holds the current question info in session variable which you can access from other module.

Quiz

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week