I just installed Watcher on my development site, and after wasting a lot of time with Notifications I am very pleased with it. However, it doesn't work for anonymous users. When I click "You are not watching this post..." it fades out, and then immediately goes back to "You are not watching this post..."

Obviously it is working for some people; any idea what might be wrong here? I tried installing Captcha to see if that made a different, but it did not.

I tested it with Safari and Firefox. I can provide additional system information if that will help.

Comments

solipsist’s picture

If you click that link while logged out you should see a form where you can enter your email address. Does it work when you're logged in?

starkos’s picture

Yes, if I am logged in it works great. But when I am logged out I don't see the form. Since it is working for other people I suspect it is something about my particular configuration, but I am not sure what steps to take to diagnose it.

solipsist’s picture

Does changing browser make any difference?

solipsist’s picture

Status: Active » Postponed (maintainer needs more info)
starkos’s picture

The browser does not make a difference. I have tried Firefox (Mac), Safari (Mac), and IE (Windows). I click the link, it fades out, and the fades right back in with "You are not watching this post..."

solipsist’s picture

I can't replicate it on my own machine. Is it a fresh Drupal install?

starkos’s picture

No, this site has been around for a while -- I just tried setting up a clean install and it works fine there. This site started on 5.x, now on 6.x. I'm not using any crazy setups though, and only a handful of addons: admin menu, marksmarty, feedburner, mollom, pathauto, google analytics.

It's a dev site so I can tear it apart, put in debugging info, whatever. I could just use a clue on where to start looking.

solipsist’s picture

Can you try disabling your modules one by one until it works? I have a suspicion and I'd be grateful for any assistance confirming it.

starkos’s picture

I disabled and uninstalled everything except the required core modules (one by one) and it still does not work. When I get back to work on Monday I will try to dig into it more deeply, and see if I can figure out what the code is doing.

solipsist’s picture

Thanks for your efforts. Keep me posted on what you find.

starkos’s picture

Okay, I finally got a chance to look into this. I tried putting the link URL, which looks like this:

href="/user/0/watcher/toggle/125?destination=node%2F125"

...directly into my browser's location bar. When I navigate to this address I get a "Page not found".

Again, I don't get this on a clean install, so it is possibly bad data on my site. I'll keep poking at it but any ideas on where to look would be much appreciated.

starkos’s picture

And, as always, as soon as I post inspiration strikes and I figure out the problem. There was no uid0 entry in {users} for this site. Somehow the uid for the anonymous user had changed to 85. Now I've got to go figure out what the hell happened, but it isn't a problem with Watcher.

solipsist’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Tricky that one! I'll add a note about it in the README file in case someone else has the same problem. Thanks for posting the solution!

solipsist’s picture

For others with the same issue, this SQL query will restore the anonymous user:

INSERT INTO `users` VALUES (0, '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, NULL, '', '', '', NULL);
starkos’s picture

Actually, in my case the record still existed, but the ID had gotten modified. I've found that it happens when I restore a database dump (in particular, when I load the backup of my production site into my development database). I can restore it like so:

UPDATE `users` SET uid=0 WHERE name='';

I'm still trying to figure out how to prevent it in the first place. When I do I'll post the answer.

solipsist’s picture

Actually I recall having run into this before now that you describe it to me. When Schema API was introduced and db_next_id() was deprecated making Drupal rely on a database level auto increment counter, an error was introduced. The uid column wasn't conceived to work with a database level increment so it was allowed to hold a 0. MySQL doesn't allow 0 values in auto increment columns, that's why it gets lost during the import as its considered illegal. As a result, the INSERT query above might not work.