Hi
I wrote a wizard using the CTools Framework. The wizard is for registration purpose, so only anonymous user will use the wizard. According to the documentation, I disabled caching of form for the wizard.
But unfortunately CTools Wizard won't work.
I debugged and found the following problem:
1. function ctools_object_cache_set()
- CTools saves the $storage variable in the ctools_object_cache table using the session id of the user.
2. function ctools_object_cache_get($obj, $name, $skip_cache = FALSE) {}
- CTools retrieves the object cache using the session id (session_id()).
Unfortunatly on every page reload, in my case the session id for an anonymous user was different.
Does someone know a solution for this problem? I need some kind of a constant session id for anonymous user.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | ctools-object-cache.inc-session-handling.patch | 743 bytes | ayalon |
| #2 | ctools-object-cache.inc-session-handling.patch | 696 bytes | ayalon |
Comments
Comment #1
merlinofchaos commentedI haven't tried this, but a conversation I had at Drupalcon suggested this might come up.
The proposed solution: In the first _submit callback for the wizard, add something to $_SESSION which will force Drupal to keep a permanent session for that anonymous user.
It's entirely possible that the caching system should do this automatically.
Comment #2
ayalon commentedI think I figured out the problem. Maybe it's because I'm using Drupal Pressflow.
Anyway, this is an issue that will raise problem with Drupal 7, which has the same session handling mechanism as Pressflow.
I finally found the solution in the mollom issue queue:
http://drupal.org/node/562374
The wrote a patch that saves the session id in the user session to force a session for anonymous user.
I made a path that works exactly the same way and solves the session id problem.
Can anyoune have a look at this and this?
Comment #3
merlinofchaos commentedYeah, that's what I was thinking of. Can we do this *only* for the anonymous user? We don't need to do this for authenticated users, so why waste the bits?
Comment #4
merlinofchaos commentedI'm thinking this:
Comment #5
ayalon commentedYou are right, it's necessary for anonymous users only.
But I think your code will not work. Anonymous user have a $user->uid = 0 and not empty.
I have implemented the code above and it works well.
Comment #6
merlinofchaos commented=)
Comment #7
merlinofchaos commentedAlso, I'm not sure we really need to even put the session ID there. I'm not sure it matters, but since the information is superfluous, let's put something more meaningful there.
That's much more descriptive.
Comment #8
ayalon commentedOk, I followed your advice. Attached you find a new patch.
Can you please review and commit it?
Comment #9
merlinofchaos commentedComment #10
merlinofchaos commentedOk, your patch is malformed -- it's a patch against your last patch rather than against current CTools.
It also seems you're placing this in cache_get -- but I'd rather do it in cache_set. There's no point in holding the session ID unless we are actually writing data.
Committed a version that goes in the cache_set function.