Anonymous users keep getting redirected to the first question when clicking the next button.
I have my drupal caching disabled. PHP 5.3 and Mysql 5.1

Comments

falcon’s picture

Status: Active » Postponed (maintainer needs more info)

Can't reproduce this one. I have an almost vanilla install and tried with no randomization and categorized random questions. Could you please try to change your settings around to see if this only happens with specific settings? Also try to disable some of the modules you are using to see if any of those might be causing this error.

Could you provide a link to the quiz? If you don't want to post it here you can use my contact form.

nickdoherty’s picture

I have this issue too.

I am using the Multiple Choice quiz content types. There are 10 questions with each question containing 4 options.

Multiple answers, Random Order, Simple scoring are turned off.

While radio boxes are being used (due to Multiple Answers) however this still occurs with checkboxes.

All 4 multiple choice options are acceptable and are given a score from 1 - 4.

Anonymous users can't get past the first question, validation doesn't occur. Caching is turned off. I looked at the quiz.module code for hours attempting to sort out the issue however couldn't find anything.

Authenticated users have no issues filling out the quiz.

Any ideas?

jeffromansfield’s picture

I am having this issue too.

Authenticated users can use the quiz fine, but anonymous cant get past the same question.

Nico_O are you using Multiple Choice ?

beauz’s picture

I'm getting stuck on this same problem here too.

It's got me stumped in that I can't work out how to reproduce it on a clean install, but definitely seeing it on an existing site. Thing is I have tried everything on that site including switching to Garland and disabling all other modules on the site, even completely removed and uninstalled quiz4, reinstalled and set up new quizzes and questions.

I get to question 1, click next, the same page reloads with a new quizkey querystring
take?quizkey=b981138bd574352155e2cfbb7d337133
take?quizkey=87983923c4e660e66ba1409df884ea99
etc.

Also doesnt seem to validate the form, even if my quiz normally requires me to select one answer out of the radio buttons, I don't get any validation error if I leave them all empty before submit.

Really got me stumped...

Nico_0’s picture

Falcon, I sent the link through your contact form.

I am using multiple choice questions.

JBloch’s picture

I am having the same problem too but it on appears on Internet Explorer (at least on IE8 and IE9). No problems on Chrome or Firefox.

nickdoherty’s picture

After nearly 3 days of attempting to fix this, going through every line of code, and losing a lot of sleep, I finally figured it out.

The solution is so simple I shed a tear upon its discovery.

Check your users table, if you are missing a user with the id of 0, this is the user that gets assigned sessions via the quiz module. If you don't have a user 0 (all details except ID should be blank) you need to create one.

tldr; Make sure User 0 exists in your Users table. If not add it. Problem solved.

Nico_0’s picture

Thanks, that worked for me!
It looks like a couple of my sites lost the user 0 through database migrations.

falcon’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

So many people has this bug? Well, I'm glad you figured it out!

JBloch’s picture

Thnx for the solution but it didn't fix my problem.
I still couldn't get past the first question in IE8 and IE9.

After tons of debuging, I discovered that I got a new session each time I pressed the NEXT button and therefore the test restarted again and again.
This only happens with IE and not with Firefox or Chrome.

The solution for me was to get rid off an underscore in my subdomain name. This is appently a feature in IE ( thnx for that MS).

beauz’s picture

@nickdoherty - you're a champion, I owe you a beer.

@falcon - Is there any way to code a check in for this? Seems a common issue...

falcon’s picture

Yes, but does anyone have any idea as to why this is happening? (Why user 0 is missing on so many installs that is)

gateone’s picture

I have run into the same thing. What happens here is the following:

The fundamental problem is the index in the MySQL-table "user". MySQL actually won't really allow a 0 as a value for an auto-incremented table! Particularly if you move your database from database to database, the 0 value in the user table gets omitted, instead it will enter the next available ID, so if you have user IDs from 1 to 10, instead of the 0 for the anonymous user, it will place a 11 there.

I suppose this might also happen on some system settings - particularly shared environments - when you initially install Drupal. It is though a bit amazing, nobody has really done anything about this already.

So to cure this problem:

Go to the user table of your Drupal installation - phpMyAdmin or Navicat or the good old SQL command line will help you there. For not so experienced users, try phpMyAdmin which many hosting providers already have set up for you or even simpler, use Navicat, a visual SQL-Editor. You can start out with the free Navicat for MySQL which is limited to its full version but does this job quite well.

Now the very first entry of this table should be uid = 0 with name, pass, mail all empty. You will likely find any random number on uid. The second line of this table should be uid 1.

So simply change the value on uid for this first line with no name, pass, mail from whatever there is to 0

This however, will not do the trick if you already tried it out and got the error. Why? Because your session table already contains data. So as a last step, truncate the session table and now try again as anonymous. Voila!

Cheers, Steve.

sivaji_ganesh_jojodae’s picture

Quiz could not do anything about anonymous uid. There is an issue raised against Drupal core project for this bug, see #350407: Anonymous should not appear in the users table at all for fix. Please post your opinions there. To restore the anonymous uid see Drupal handbook page Restoring the Anonymous (user ID 0) user record