From dcea6ffb1bacaa050f0d2a0d2656c075c8fc94ea Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 11 Sep 2011 18:43:22 -0400 Subject: [PATCH] - Patch #1185842 by Dave Reid: the [node:author] token does not use format_username(). --- modules/node/node.test | 1 + modules/node/node.tokens.inc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/node/node.test b/modules/node/node.test index 56a2d342684..8a1899eb3eb 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -2270,6 +2270,7 @@ class NodeTokenReplaceTestCase extends DrupalWebTestCase { $tests['[node:language]'] = check_plain($node->language); $tests['[node:url]'] = url('node/' . $node->nid, $url_options); $tests['[node:edit-url]'] = url('node/' . $node->nid . '/edit', $url_options); + $tests['[node:author]'] = check_plain(format_username($account)); $tests['[node:author:uid]'] = $node->uid; $tests['[node:author:name]'] = check_plain(format_username($account)); $tests['[node:created:since]'] = format_interval(REQUEST_TIME - $node->created, 2, $language->language); diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc index 80dbda517a0..b6bafc63907 100644 --- a/modules/node/node.tokens.inc +++ b/modules/node/node.tokens.inc @@ -157,8 +157,9 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr // Default values for the chained tokens handled below. case 'author': - $name = ($node->uid == 0) ? variable_get('anonymous', t('Anonymous')) : $node->name; - $replacements[$original] = $sanitize ? filter_xss($name) : $name; + $account = user_load($node->uid); + $name = format_username($account); + $replacements[$original] = $sanitize ? check_plain($name) : $name; break; case 'created':