Currently userpoints are never logged for the anonymous user 0.
I think there are use cases for logging points for anonymous.
There are sites where anonymous users are allowed to add nodes, comments etc. (things that points can often be tied to).
This can be useful for tracking things that anonymous users are doing in relation to authenticated users.
It wouldn't be useful to everyone and it also isn't super scalable in that if your site has a lot of activity the user points transaction table could get enormous, but for some cases it could be useful.
Maybe there could be a setting that allows enabling it, although it would probably be better if it were a less generic setting, which means maybe it can be a new (optional) param passed into userpoints_userpointsapi, and modules that utilise that function can have additional settings that allow recording points for anonymous.
I can't see any negative to adding the ability as it would be entirely optional and the code change to userpoints would be very minimal.
Comment | File | Size | Author |
---|---|---|---|
#1 | userpoints-allow_anonymous_points-1717980-1.patch | 1.72 KB | rooby |
Comments
Comment #1
rooby CreditAttribution: rooby commentedHere is a patch that allows this.
Comment #2
diwant CreditAttribution: diwant commentedJust pawed through the patch, good work! I have a question, if multiple anonymous users earn points in separate sessions, this will not track that, will it?
Comment #3
rooby CreditAttribution: rooby commentedI'm finding it a little hard to remember exactly how I was using this now as I do not currently have access to the site this was for.
This patch does not really do anything visible by itself, it just stops userpoints from rejecting anonymous user points.
Then with other modules you can log user points for anonymous users. In my case it was a little custom module.
It is really up to the other modules as to how to implement it.
You could store points per session if you wanted, however sessions change so I'm not sure
For my use case when I wrote the patch I only had to record overall anonymous points so I didn't care about that sessions.
Sessions being as volatile as they are might also be an issue for you, although I don't know your use case.
Comment #4
diwant CreditAttribution: diwant commentedI see. I'm going to try to use the Ctools Object cache for my case. But I will be leaving userpoints alone when doing that.
And thanks!
Comment #5
queryblitz CreditAttribution: queryblitz commentedI'm trying to make this work with Drupal 6... would be awesome. I only need to record userpoints for a few seconds max (one pageload), but without it I'm pulling my hair out trying to track anonymous user actions.