Hi all,

I've started writing my first Drupal module (integrating Invision Powerboard user login) and overall it's going quite well. However, since a while (don't know for sure when it first happened) I get an error message when trying to disable my module. The error is: "Validation error, please try again. If this error persists, please contact the site administrator." When the error shows, the module seems disabled, but refreshing the list shows it enabled again.

Any help on how to tackle this problem would be greatly appreciated! So far I've managed by looking at (and copying...) code from other modules, but for this one that doesn't work. I've also searched for some documentation on this error, but couldn't find any. If I need to supply more information or code, please let me know.

Thanks!

Comments

Whiskey’s picture

Seems I have broken something as disabling any module now gives me that error. Only thing I changed within Drupal was to delete my module a few times in the system table (to test reinstalling). Could that be related? Don't think I touched anything else.

Edit: just reinstalled Drupal and I still get the validation error when trying to disable my module :(

Whiskey’s picture

Nobody knows what I can do to fix this? Any pointers are most welcome, also on how to troubleshoot this. Thanks.

j_ten_man’s picture

How about showing us some code from your .install file and possibly your .module file. I am not sure where the error is occuring, but things of interest will be hook_menu and hook_perm as well as any other hooks you have implemented in the .module file.

Whiskey’s picture

Ok, I nailed the cause which is not to say I have a solution. I'm doing an automatic login for Drupal if an IPB forum session exists. To do that, I learned from another module you need to call sess_regenerate() when an anonymous user becomes authenticated. But this seems to cause the validation error because when I'm not using this function, I can disable my module. Any thoughts on how I can let them play nicely together?

Whiskey’s picture

Turns out there was a bug in my code that caused sess_regenerate to be called on every page request. The sess_regenerate creates a different token (or does something else) that messes up the token validation and so causes the validation error. I changed my code to only use sess_regenerate when actually logging a user in and now life is good again :) Hope this little story helps others.