I just recently ran into a really weird ...well, bug I guess.

When doing a search on my site, I'm running into some weirdness whenever a quiz is returned in the search results. The following seems to be occurring:

1. The search page title changes to the title of the quiz. It's as if $title was overridden by the quiz, and instead of saying "Search" in the head tag and at the top of the page, I'm getting the title of my quiz instead. This occurs even after disabling the module.

2. When I created a test quiz that didn't have any questions and did a search, my search page displayed the "No questions were found. Please assign questions before trying to take this Quiz." error message at the top.

3. When using Drupal for Firebug, I can see that the Quiz is being loaded as a search result, plus the first question of that quiz is also being loaded, but just a regular load, not as a search result.

4. When doing a search as an anonymous user that returns a multi-choice question in the results, I get an access denied page instead of the results page. If I give my anonymous user "create multichoice", then the access denied message goes away. (I'm still having problems just having search results displayed for anonymous users, but that's a whole other problem) (Incidentally, is there any way to prevent multi-choice questions from being indexed and returned in search results?)

Any ideas as to what's going on here? I used CCK to add a few new fields to my quiz content type (some text fields, image fields, etc.) Might that be mucking things up?

Using:
Drupal 6.10
Quiz 6.x-2.1

Thanks!

CommentFileSizeAuthor
#11 Screenshot.png67.35 KBsivaji_ganesh_jojodae

Comments

mbutcher’s picture

Would you mind testing in Quiz 3?

I suspect that something funny is happening in the Node API. I changed the way quizzes were loaded between 2.1 and 3 (to support CCK, actually), so I am curious whether this bug exists in the new code.

Stephen Scholtz’s picture

Sure, I'll have a look at it in a few days. I'm under the gun with a deadline at the moment, but I have a local copy of the site in question set up on which I could put Quiz 3 and see how it goes.

mbutcher’s picture

Status: Active » Postponed (maintainer needs more info)

Trying to clean up the issue queue for an Alpha release, so I'm setting the status to "Needs more info"

mbutcher’s picture

Version: 6.x-2.1 » 6.x-3.x-dev

marked as Quiz 3

Stephen Scholtz’s picture

Hi there,

Sorry, still haven't had a chance to install Quiz 3 and see what happens with this bug, in the middle of crunch time right now. Hopefully next week. :P

Stephen Scholtz’s picture

Hoping to test out Quiz 3 tomorrow, I need to mirror my production site and then install it. Will see what happens with Quiz 3 and search results.

Stephen Scholtz’s picture

Finally got this set up on my local machine and test with Quiz 3. Unfortunately, the bug still exists.

The only change I see is that now I get a couple of extra status messages showing up:

Resuming a previous quiz in-progress.
You are viewing a question outside of a quiz. This is not scored.

Sometimes those messages will appear multiple times on the search result page.

One thing I noticed, if it helps, is that this Title overwrite only seems to happen when the search results contain a quiz. If the search results contain a Multi-choice question, it seems to be fine. (Digression for beginner Drupal users: will be looking into something like Search Config to remove the Multi-choice content type from the Search indexing; haven't tested it yet, but might work)

Using:
Drupal 6.10
MySQL 5.0.67
PHP 5.2.9
Quiz 3.0-Beta 1

Will upgrade to Drupal 6.12 on my local environment tomorrow and see if that does anything.

mbutcher’s picture

Ah... I understand. When search results return quiz items, too much is getting loaded. I guess I'd better find out what sort of node_view() a search call does and make sure we handle that.

mbutcher’s picture

Status: Postponed (maintainer needs more info) » Active

Guess this should be marked active again.

rblomme’s picture

Maybe drupal_set_title() should not be executed in quiz_take_quiz() (called by quiz_view()) while displaying search results... ?

sivaji_ganesh_jojodae’s picture

StatusFileSize
new67.35 KB

rblomme yes, you are correct.

Also the Search result page looks very weird for me (please check the snapshot)

rblomme’s picture

Use the $page parameter from the quiz_view hook:

function quiz_take_quiz($quiz, $page) {
  ...
  if ($page) {drupal_set_title(check_plain($quiz->title)); }
  ...
}
sivaji_ganesh_jojodae’s picture

Status: Active » Fixed

@rblomme Thanks for the $page parameter trick. The following changes has fixed this issue.

1. in multichoice.module

 function multichoice_view($node, $teaser = FALSE, $page = FALSE) {
-  if (!$teaser /*&& user_access('create multichoice')*/) {
+  if (!$teaser && $page /*&& user_access('create multichoice')*/) {

2 in quiz.module

 function quiz_view($node, $teaser = FALSE, $page = FALSE) {
   drupal_alter('quiz_view', $node, $teaser, $page);
-  if (!$teaser) {
+  if (!$teaser && $page) {

Status: Fixed » Closed (fixed)
Issue tags: -search

Automatically closed -- issue fixed for 2 weeks with no activity.