Closed (duplicate)
Project:
Drupal core
Version:
x.y.z
Component:
user.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2005 at 17:44 UTC
Updated:
17 Dec 2005 at 12:46 UTC
more from the patches i have on top of drupal cvs to get things to work right. This one fixes the problem where sort and mode don't get set correctly when users register.
| Comment | File | Size | Author |
|---|---|---|---|
| set_sort_and_mode.patch | 2.61 KB | Wesley Tanaka |
Comments
Comment #1
Wesley Tanaka commentedComment #2
dries commentedNot sure this is the proper fix; I'd think this needs fixing in comment.module. After your patch, when the administrator changes the defaults, this will only affect new users and not existing users that never changed the defaults.
Comment #3
Wesley Tanaka commentedwhy are the columns even in the database then? oh, for the users that change the default...
hmm. that's a huge problem then.
Unfortunately, 0 is already used both by:
define('COMMENT_ORDER_NEWEST_FIRST', 0);
and by
define('COMMENT_CONTROLS_ABOVE', 0);
perhaps NULL would represent users that haven't touched their settings? the mode column would need to be modified to accept NULL.
Comment #4
Wesley Tanaka commentedI argue that this should get committed anyway.
Modulo the weirdness that occurs due to: http://drupal.org/node/40570
what you've described as happening after this patch already is what is happening today. This patch makes things no worse than things are today, and is probably good to have in the beta series until the "real fix" happens.
It looks like the only reason that things seem to work today is that most administrators must not change the default comment settings in the first place. Thus, all their users' "mode" and "sort" are set to COMMENT_MODE_FLAT_COLLAPSED and COMMENT_ORDER_NEWEST_FIRST, and because of bug 40570, those are actually misinterpreted to be "give me the defaults"
Comment #5
Wesley Tanaka commentedHere's a potential migration path to a "better fix" after this patch gets committed:
1) drop mode and sort columns from the users table in the database
2) during the upgrade procedure that drops those columns, re-save the mode and sort information in the "data" column, if they weren't set to 0 (to preserve the behavior from bug 40570
3) fix bug 40570 by changing the test to isset($user->mode) and isset($user->sort) (which would properly distinguish "unset" from the number 0)
Or:
1) allow both mode and sort columns to take NULL
2) update all mode and sort columns with value 0 to NULL during the upgrade
3) test for $user->mode === NULL or $user=>sort === NULL (or unset, I'm not sure how user_load works in this case)
Comment #6
Wesley Tanaka commentedverified that patch still applies against 4.7.0-test2
Comment #7
Wesley Tanaka commentedaha. found it. I think this is a duplicate of http://drupal.org/node/40761, which has a better way of dealing with the problem.
Comment #8
Wesley Tanaka commented