Once a user has been switched from active to blocked state in user administration, their "Member since:" date shows since UNIX epoch.

CommentFileSizeAuthor
#4 user.module_4.patch415 bytesviksit
blockeduserepoch.png4.15 KBdeekayen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deekayen’s picture

Priority: Normal » Minor

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'.

viksit’s picture

Looking at it.

viksit’s picture

Assigned: Unassigned » viksit

Ah, assigned.

viksit’s picture

FileSize
415 bytes

Well, I tried alternate approaches, but what seemed to work best was as suggested above.
The patch's attached here..

Cheers,

viksit’s picture

Status: Active » Needs review

uploaded above..

Bèr Kessels’s picture

Status: Needs review » 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.

Robin Monks’s picture

-1 from me too.

This has far reaching consequences. Can't we just fix the date query?

Robin

deekayen’s picture

Status: Needs work » Fixed

appears to be fixed in HEAD

Anonymous’s picture

Status: Fixed » Closed (fixed)