diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-12-09 01:57:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-12-09 01:57:56 +0000 |
commit | f2b57f20724ce81c611ea19be33d4e71646c6560 (patch) | |
tree | c4b921383436cdb6b7bab7707326fbe0f8a66354 /modules/comment/comment.module | |
parent | 81f2f3c19a9a850d5a30ffadc7e342aac92a68cb (diff) | |
download | brdo-f2b57f20724ce81c611ea19be33d4e71646c6560.tar.gz brdo-f2b57f20724ce81c611ea19be33d4e71646c6560.tar.bz2 |
- Patch #632382 by mr.baileys, sun: 'Your name' should not be prepopulated with Anonymous.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r-- | modules/comment/comment.module | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 4ccc6b65b..d2286f333 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1901,7 +1901,7 @@ function comment_form($form, &$form_state, $comment) { $author = $user->name; } else { - $author = ($comment->name ? $comment->name : variable_get('anonymous', t('Anonymous'))); + $author = ($comment->name ? $comment->name : ''); } $status = (user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED); $date = ''; @@ -2146,13 +2146,19 @@ function comment_submit($comment) { if (empty($comment->date)) { $comment->date = 'now'; } - $comment->created = strtotime($comment->date); $comment->changed = REQUEST_TIME; + // If the comment was posted by a registered user, assign the author's ID. + // @todo Too fragile. Should be prepared and stored in comment_form() already. if (!$comment->is_anonymous && !empty($comment->name) && ($account = user_load_by_name($comment->name))) { $comment->uid = $account->uid; } + // If the comment was posted by an anonymous user and no author name was + // required, use "Anonymous" by default. + if ($comment->is_anonymous && (!isset($comment->name) || $comment->name === '')) { + $comment->name = variable_get('anonymous', t('Anonymous')); + } // Validate the comment's subject. If not specified, extract from comment body. if (trim($comment->subject) == '') { |