diff --git a/nodechanges.module b/nodechanges.module index 5d5e65b..d2fafa3 100644 --- a/nodechanges.module +++ b/nodechanges.module @@ -1497,6 +1497,7 @@ function nodechanges_node_view($node, $view_mode, $langcode) { $comment = nodechanges_comment_create($node, $comment); $comment->created = $comment->changed = REQUEST_TIME; $comment->subject = ''; + $comment->in_preview = TRUE; if (!nodechanges_comment_is_empty($comment)) { $field_info = field_info_extra_fields('node', $node->type, 'form'); // Show comment body on node preview. @@ -1679,9 +1680,11 @@ function nodechanges_comment_create($node, $comment = NULL) { $comment->cid = isset($node->nodechanges_cid) ? $node->nodechanges_cid : NULL; if (isset($node->nodechanges_uid)) { $comment->uid = $node->nodechanges_uid; + $user_data = user_load($node->nodechanges_uid); } else { $comment->uid = $GLOBALS['user']->uid; + $user_data = $GLOBALS['user']; } // Ensure the comment has a valid 'status' state, if not already set. // @todo Decide how to handle when user_access('post comments') == FALSE. @@ -1698,6 +1701,11 @@ function nodechanges_comment_create($node, $comment = NULL) { $comment->{$attr} = $value; } } + // Fill comment with user data + $comment->name = check_plain($user_data->name); + $comment->picture = $user_data->picture; + $comment->signature = $user_data->signature; + $comment->signature_format = $user_data->signature_format; return $comment; }