[drupal-devel] [bug] blocked users have been members since unix
epoch
Bèr Kessels
drupal-devel at drupal.org
Mon Aug 8 10:42:52 UTC 2005
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: Bèr Kessels
-Status: patch (code needs review)
+Status: patch (code needs work)
Hmm, I dislike the idea of this. Simply taking out that status =1
parameter, will show blocked users on certain areas, where you /dont/
want them to show up at all.
The user page, for one, must not be accessible for users that are
blocked.
Bèr Kessels
Previous comments:
------------------------------------------------------------------------
Sun, 19 Jun 2005 22:15:34 +0000 : 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.
------------------------------------------------------------------------
Thu, 23 Jun 2005 05:10:18 +0000 : 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'.
------------------------------------------------------------------------
Tue, 28 Jun 2005 21:26:53 +0000 : viksit
Looking at it.
------------------------------------------------------------------------
Tue, 28 Jun 2005 21:33:45 +0000 : viksit
Ah, assigned.
------------------------------------------------------------------------
Sat, 02 Jul 2005 19:38:50 +0000 : 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,
------------------------------------------------------------------------
Sun, 03 Jul 2005 21:25:54 +0000 : viksit
uploaded above..
More information about the drupal-devel
mailing list