[drupal-devel] [bug] blocked users have been members since unix epoch
Issue status update for http://drupal.org/node/25325 Post a follow up: http://drupal.org/project/comments/add/25325 Project: Drupal Version: cvs Component: user.module Category: bug reports Priority: minor Assigned to: viksit Reported by: deekayen Updated by: viksit -Status: active +Status: patch uploaded above.. viksit Previous comments: ------------------------------------------------------------------------ June 19, 2005 - 22:15 : deekayen Attachment: http://drupal.org/files/issues/blockeduserepoch.png (4.15 KB) Once a user has been switched from active to blocked state in user administration, their "Member since:" date shows since UNIX epoch. ------------------------------------------------------------------------ June 23, 2005 - 05:10 : deekayen So far I blame the query in user_load() which comes out something like: SELECT u.* FROM users u WHERE u.uid = 3 AND LOWER(u.status) = '1' AND u.status < 3 LIMIT 0, 1 Then user_load() never calls user_module_invoke() in the db_num_rows() if statement because blocked users don't return because of the LOWER(u.status) = '1' in the query. So when user_user does math on an empty $user object, the date comes out wrong when loading the view page on a blocked user. I don't know why the if statement of user_view() forces 'status' => 1, but if you remove it, the blocked user "Member since" date is corrected. function user_view($uid = 0) { global $user; if ($account = user_load(array('uid' => $uid))) { The only call I saw for user_view() in grep was in user_page(). One of the side effects of this bug was blocked users didn't have anything show under their History part of their View tab. For example, removing 'status' => 1 will show "view recent blog entries" if you have blog.module loaded. I don't really think that's my position to say if that's a desireable behavior or not, so I'll just leave this hanging. I also don't really know what status > 1 would mean, so it might instead be desireable to make a change so the query in user_load() grabs LOWER(u.status) <= '1'. ------------------------------------------------------------------------ June 28, 2005 - 21:26 : viksit Looking at it. ------------------------------------------------------------------------ June 28, 2005 - 21:33 : viksit Ah, assigned. ------------------------------------------------------------------------ July 2, 2005 - 19:38 : viksit Attachment: http://drupal.org/files/issues/user.module_4.patch (415 bytes) Well, I tried alternate approaches, but what seemed to work best was as suggested above. The patch's attached here.. Cheers,
participants (1)
-
viksit