User "0" is a valid name in D6 (and soon to be in D7). See

#266488: Cleanup for user_validate_name() + tests
#845472: Robustly determine when strings are empty

However pathauto does not generate an alias for this user due to

function pathauto_user($op, &$edit, &$user, $category = FALSE) {
...
      if ($user->name) {

This patch changes it to

      if ($user->uid) {
CommentFileSizeAuthor
pathauto-user0.patch769 byteslyricnz

Comments

Status: Needs review » Needs work

The last submitted patch, pathauto-user0.patch, failed testing.

lyricnz’s picture

Those test failures look unrelated to this patch. They also run: 83 passes, 0 fails, and 0 exceptions here. Will resubmit in a bit.

PS: The question of whether or not "0" should be a valid name is not entirely resolved in core. Currently it's valid in D6 (with bugs), and invalid in D7. See this issues highlighted above.

dave reid’s picture

FYI the testbot errors are because it's not installing token.module even though it's a module dependency.

dave reid’s picture

Do we really need this check on $user->uid at all? I don't think it's possible to execute any conditions from the core UI for anonymous users.

greggles’s picture

There were a variety of bug reports about aliases being created empty. I think we are checking for that later on at this point.

What about doing:


if ($user->name || $user->name === '0') {

}

lyricnz’s picture

That's awfully specific. What about

if (isset($user->name) && $user->name !== '') {
}
dave reid’s picture

Status: Needs work » Fixed

I actually looked back and it's been checking $user->name since a *looooooong* time ago, at least before 2005. In 7.x-1.x and 6.x-2.x with the bulk API patch that went in, this check was removed. We can prevent things going wrong if $user->name is empty with #867854: Do not generate alias if pattern does not have any tokens replaced.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.