I dont know if it's really a bug, but...

In my website drupal 5.4, new users can request an account, but the new account is created "blocked", then "admin" must enable it manually.

I found that, starting with drupal 5.4, when the admin enables the account, drupal also updates the "last access" field of the user.

Seems its a feature introduced in user.module with drupal 5.4:

// Consider users created by an administrator as already logged in, so
// anonymous users can view the profile (if allowed).
if (empty($array['access']) && user_access('administer users')) {
$array['access'] = time();
}

These new lines are present twice in that module. They work not only
when admin creates user, but also when he modifies it.

So, also if user still never logged in, the "last access" field is no more "never".
In my opinion this is not correct, because honestly I expect to see when an user never really login in.

Thanks in advance! :)

Comments

JirkaRybka’s picture

Status: Active » Closed (works as designed)

This was intentionally added (well, I proposed that along with others) because there's an anti-spam measure, so that user profiles with access 'never' (i.e. not logged-in yet) are not visible. But there are scenarios, where administrators want to make such profiles active, for example when they create dummy profiles for persons not really going to log in technically - for example to show some VIP's in-line with really active members, or to simply submit nodes for them (contents received by site-maintainer via e-mail for example, intended to be later editable by the real author). If the person in question already registered, this needs to be done through editing an existing account, due to the duplicite e-mail check on newly added accounts.

Previously, these scenarios led to user profiles full of useful information and/or owning nodes, but showing ugly 404 page if clicked, and administrators had no chance to change that (unless taking over the account by forcing password change and logging in to these accounts themselves once, in fact denying access to the real owner due to the password change). The viewing restriction (i.e. a 404 for profiles with access 'never') may not be removed, as it's our safeguard against registration spam.

IMO, technically, admin's manual edit/creation of the account IS a sort of activity (although with 'forced' access to the account), so it's not so totally wrong. Note that this only occurs on first access ever (for orphan accounts, more or less); if the user already logged in and so started to use the account, admin interference no more counts.

See the original issue: http://drupal.org/node/171117

salvis’s picture

Version: 5.4 » 6.x-dev
Priority: Normal » Critical
Status: Closed (works as designed) » Active

I understand that you've tried to fix a problem, but you've created a new one!

Being able to easily tell whether an invited user has actually logged in or not is a basic necessity, and you've killed the "Who's new" block. I'm surprised that you threw that out so easily...

In your own words: "Basically what this patch does, is that Drupal consider an admin-manually-edited/added account as already logged in once, so EVERYONE with the permission can access it."

Considering A as B when it's not B is a quirky hack that may work for your special situation, but this must not be default behavior. If you really need this quirky behavior then make it an option (turned off by default).

I've come across this problem in D55 and need it fixed there, but apparently you've managed to introduce it into D6, too, so I'm marking the issue for D6.

catch’s picture

Priority: Critical » Minor

Salvis, if you need to know if users are logging in or not, you can use the triggers module to send notifications. The "Who's new" block is still there by the way.

salvis’s picture

Priority: Minor » Normal

No, this is basic functionality, a contrib module and a manual list won't do. A core listing has to show things how they are, and "Who's new" has to show who has actually arrived at the site, not who has been invited.

francoud’s picture

I honestly agree with Salvis. I expect that if an user never log in, it's marked as "never" login. It's needed, because I need to understand when I have inactive users (users who never really log in)- so I can delete them. Suddenly loosing this feature is a really big problem. Now I must choose if not installing 5.4/ 5.5 (leaving all my websites to 5.3...) or patching drupal by myself (and this is not a good idea...).

Hard to accept because all previous drupal versions worked perfectly... it's sad :(

JirkaRybka’s picture

Without the patch, I was unable to delete inactive users - it'll remove also dummy profiles created by other admins, and owning nodes. That's why I never cleaned my site of bogus registrations, which is sad, too. We need a good solution for both cases, probably introducing some new "invited" status. Unfortunately that's a feature, and so impossible until 7.x

catch’s picture

francoud - "inactive user" module works quite well setting a time limit on users who haven't logged in for a long time.

francoud’s picture

I'm sure we can find workarounds, using modules or other tricks. I'm just sad that a standard feature has been "broken". Dont be upset, nothing of personal ;) of course I understand it was to solve another problem. But now it's me, having a new problem... :-/

For what regards myself, I think the solution I will adopt will be to just comment out those 2 "if" statements in user.module (in drupal 5.4-5.5). As far as I can see, it works - surely I lost the solution to the other problem... but it's not mine problem ;)

I agree with salvis again, that could be a clean solution to make this new feature an option: maybe in the user settings, something like:
[ ] modify a new user should imply a new access time so that JirkaRybka can delete his inactive users
[x] modify a new user should leave user's access time untouched so that francoud can delete his inactive users

;-)

I'm not so good with php so I'm not sure I could implement this by myself... but maybe I could try... I dont know :)

Thanks for your work anyway.

fb

catch’s picture

There could maybe be something in the admin/user/add form which says "mark this user as active" with a checkbox (checked by default). If it's unchecked, then the user never logged in as before. This wouldn't be a huge change I guess.

francoud’s picture

I'm afraid I've not still the knowledge to do it quickly... :(

salvis’s picture

@catch: Yes, this is a good idea, but the checkbox needs to be OFF by default, because turning it on results in illegitimate behavior.

Actually, it should be accompanied by a warning, something like "Do not turn this on, unless the user has agreed to join the site."

Anonymous’s picture

I agree with catch's idea as well. We don't want to surprise the administrators of a site with some SPAM user becoming active. With the patch that was applied at #171117: Regression: users without administer users permission can not access user profiles of users that never logged in if I modify the user from blocked to active then I've just updated the access to now and that isn't what I wanted to do. I want to know when the user first logged in if ever. This will be cumbersome for the administrators who allow registration but want to approve the account first. Not good and should have never have been back ported to D-5.

senpai’s picture

Status: Active » Closed (duplicate)

Closing this thread, and encouraging all discussion to continue in http://drupal.org/node/171117. That thread predates this one, and that thread also has a patch that's been committed, yet some feel it shouldn't have been. Discuss amongst yourselves, but do it on node/171117.

Aveu’s picture

Status: Closed (duplicate) » Active

I am going to go out on a limb here and reactivate this issue for D6 purposes only ( I know the duplicate issue ticket is mostly about D7 since this is seen as a feature addition ). What I am going to suggest is a simple trick that is a workaround to the issue and at the same time is not a feature add ...

Keep all of the functionality of this issue AS IS in D6, i.e.: if an admin is the one who edits the account and activates it change the last access date except instead of setting the last access date to now, set it to a date of 01/01/2000. This will allow the user list to be sorted by last access and easily identify those users that are admin activated yet never accessed for real.

Also add a small line of code to Who's New that says in effect "if last access = 01/01/2000 then do not list".

No new functionality has been added, yet it now becomes easy to spot and hide/manipulate the never-been-used accounts. An example of that would be the Inactive User contrib module which could be updated to ignore all users dated 01/01/2000 and still be effective in removing idled accounts of real users.

salvis’s picture

Status: Active » Closed (duplicate)

The chances for getting anything committed in this area are NULL.

The Fix Core module fixes this (and a few other bugs) in D6.

Anonymous’s picture

Status: Closed (duplicate) » Active

But that doesn't resolve the issue of core itself being fixed.

salvis’s picture

I agree, but see #13.

Anonymous’s picture

Anonymous’s picture

Status: Needs review » Closed (duplicate)