[author-name] & [author-name-raw] don't populate for Anonymous User
ChrisRut - September 24, 2009 - 16:25
| Project: | Token |
| Version: | 6.x-1.12 |
| Component: | Token Actions |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I've setup PathAuto for my custom content type as follows: customcontenttype/[yyyy]/[mm]/[dd]/[author-name-raw]/[title-raw]
I've also tried using the non raw version of author-name as the PathAuto: customcontenttype/[yyyy]/[mm]/[dd]/[author-name]/[title-raw]
But it still won't create a listing for anonymous. Instead Anonymous user posts are placed in: I've also tried using the non raw version of author-name as the PathAuto: customcontenttype/[yyyy]/[mm]/[dd]/[title-raw] (notice there is no [author-name]).
See also: http://drupal.org/node/586828

#1
Oops, I copy and pasted that line incorrect, it should be:
But it still won't create a listing for anonymous. Instead Anonymous user posts are placed in: "customcontenttype/[yyyy]/[mm]/[dd]/[title-raw]" (notice there is no [author-name]).
#2
Also wanted to point out...
I created a view similar to a blog:
Node: created year
Node: created month
Node: created day
User: Name
Arguments Screenshot
So "/2009/09/23/Administrator" will list all the nodes created by the Administrator on 9/23/09, and "/2009/09/23/" should list all the users who created nodes on 9/23/09, however there is a catch, if the node was created by an "Anonymous" user, there is no link.
Screenshot - Notice there is a listing for Administrator, and it looks like the administrator posted 3 nodes, and there is another user with NO TITLE who posted 1 (that is the Anonymous Post).
And when I go to the node manually, and I see it is located at "customcontenttype/[yyyy]/[mm]/[dd]/[title-raw]", notice there is no [author-name] in there.
#3
The corresponding lines of code are: (grep -inr "author" .)
./token_node.inc:33: $values['author-uid'] = $node->uid;./token_node.inc:34: $values['author-name'] = check_plain($account->name);
./token_node.inc:35: $values['author-name-raw'] = $account->name;
./token_node.inc:36: $values['author-mail'] = check_plain($account->mail);
./token_node.inc:37: $values['author-mail-raw'] = $account->mail;
Would it be possible to add the following check:
<?phpif (empty($account->name)) {
$values['author-name'] = "Anonymous";
$values['author-name-raw'] = "Anonymous";
}
?>
#4
:delete:
#5
See attached patch.
Worked for me.
Needs Review
#6
I also found another solution that works thanks to merlinofchaos on IRC: Simply change the MySQL DB table "users" where "UID" = 0 set "name" = Anonymous