I have a simple view that selects a random item from a content type (daily "featured content" for use on my home page). I want to display the featured content daily, so I have:
User seed type: Use the same seed for every user
Reset seed: Every day
With these settings, though, users see different content. Some users notice the "featured content" changing more than once a day.
I've tried disabling the drupal cache completely to see if that makes a difference, and it does not appear to.
Does anyone have any tips on troubleshooting this problem further?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1289734.patch | 2.22 KB | swentel |
Comments
Comment #1
swentel commentedIt looks like you found a nice bug here. If the seed for the user is the same, the reset option shouldn't rely on the time stored in the user's session. In that case we should have a timestamp in the variables for this view as well. Because now, it's possible that the seed changes depending on the visitors of a site if they already have a session or not, for instance.
- user a visits for the first time. A variable is set and the time of is recorded in the session of this user
- user b visits 12 hours later, uses the same variable and his visit time is recorded as well
- user a comes back after 24 hours, resets the variable and the time in his session
- user b comes back after 24 hours (after his first visit), resets the variable as well although it should at least last 12 hours longer
- now if user a comes back 5 minutes after user b, he will have a different seed now because user b has reset it
Attached a patch, completely untested though, could you see if this fixes the problem ?
Comment #2
mikemccaffreyLooks like there is a parse error in that patch.
This line:
$seed_time = $options['user_seed_type'] == 'diff_per_user' ? $_SESSION[$seed_time] ? variable_get($seed_time, $time);Should probably be:
$seed_time = $options['user_seed_type'] == 'diff_per_user' ? $_SESSION[$seed_time] : variable_get($seed_time, $time);Comment #3
swentel commentedDrupal 6 is not supported anymore.
Also, this is in D7 and D8