summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-06-03 06:52:29 +0000
committerDries Buytaert <dries@buytaert.net>2009-06-03 06:52:29 +0000
commitfea41b639e71abc50547164d5bd3617e0dd68a8f (patch)
treeeea642a4347f06b4027f83dc8dcdd35e0b627c89
parent2ad42112c4bf8ba8b7137f89922dc807b565a3aa (diff)
downloadbrdo-fea41b639e71abc50547164d5bd3617e0dd68a8f.tar.gz
brdo-fea41b639e71abc50547164d5bd3617e0dd68a8f.tar.bz2
- Patch #468630 by Berdir: fixed error with publishing comments.
-rw-r--r--modules/comment/comment.api.php12
-rw-r--r--modules/comment/comment.module3
-rw-r--r--modules/comment/comment.test2
-rw-r--r--modules/search/search.module4
4 files changed, 11 insertions, 10 deletions
diff --git a/modules/comment/comment.api.php b/modules/comment/comment.api.php
index 4ab8e5c06..85ba96258 100644
--- a/modules/comment/comment.api.php
+++ b/modules/comment/comment.api.php
@@ -62,7 +62,7 @@ function hook_comment_update($form_values) {
* @return
* Nothing.
*/
-function hook_comment_view(&$comment) {
+function hook_comment_view($comment) {
// how old is the comment
$comment->time_ago = time() - $comment->timestamp;
}
@@ -71,12 +71,12 @@ function hook_comment_view(&$comment) {
* The comment is being published by the moderator.
*
* @param $form_values
- * Passes in an array of form values submitted by the user.
+ * Passes in the comment the action is being performed on.
* @return
* Nothing.
*/
-function hook_comment_publish($form_values) {
- drupal_set_message(t('Comment: @subject has been published', array('@subject' => $form_values['subject'])));
+function hook_comment_publish($comment) {
+ drupal_set_message(t('Comment: @subject has been published', array('@subject' => $comment->subject)));
}
/**
@@ -87,7 +87,7 @@ function hook_comment_publish($form_values) {
* @return
* Nothing.
*/
-function hook_comment_unpublish(&$comment) {
+function hook_comment_unpublish($comment) {
drupal_set_message(t('Comment: @subject has been unpublished', array('@subject' => $comment->subject)));
}
@@ -99,7 +99,7 @@ function hook_comment_unpublish(&$comment) {
* @return
* Nothing.
*/
-function hook_comment_delete(&$comment) {
+function hook_comment_delete($comment) {
drupal_set_message(t('Comment: @subject has been deleted', array('@subject' => $comment->subject)));
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 170d098e2..3b7129dfd 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -948,7 +948,8 @@ function comment_save($edit) {
}
else {
drupal_set_message(t('Your comment has been posted.'));
- comment_invoke_comment($edit, 'publish');
+ $comment = (object)$edit;
+ comment_invoke_comment($comment, 'publish');
}
return $edit['cid'];
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index b7c6abb0d..db5788984 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -7,7 +7,7 @@ class CommentHelperCase extends DrupalWebTestCase {
protected $node;
function setUp() {
- parent::setUp('comment');
+ parent::setUp('comment', 'search');
// Create users.
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer permissions', 'administer blocks'));
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content'));
diff --git a/modules/search/search.module b/modules/search/search.module
index f6348fc0f..20545c219 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -690,9 +690,9 @@ function search_comment_delete($comment) {
/**
* Implement hook_comment_publish().
*/
-function search_comment_publish($form_values) {
+function search_comment_publish($comment) {
// Reindex the node when comments are published.
- search_touch_node($form_values['nid']);
+ search_touch_node($comment->nid);
}
/**