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) {
| Comment | File | Size | Author |
|---|---|---|---|
| pathauto-user0.patch | 769 bytes | lyricnz |
Comments
Comment #2
lyricnz commentedThose 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.
Comment #3
dave reidFYI the testbot errors are because it's not installing token.module even though it's a module dependency.
Comment #4
dave reidDo 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.
Comment #5
gregglesThere 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:
Comment #6
lyricnz commentedThat's awfully specific. What about
Comment #7
dave reidI 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.