Commit 1897d97f authored by Christoph C. Cemper's avatar Christoph C. Cemper

initial version for drupal 4.7 moved to CVS project page

parents
This module is currently only supported for 4.7
Installation
- enable module in Drupal
- after the normal install you need to apply a patch to the core comment.module
you need - the GNU patch module (e.g. from http://gnuwin32.sourceforge.net/packages/patch.htm for windows)
then copy the patch file to the modules dif (where comment.module lies)
and type ina cmd box
patch -p0 < comment.module.patch
when it asks
File to patch:
you type in again
comment.module
as the comment.module is obviously newer than when the patch was created you
Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/Attic/comment.module,v
retrieving revision 1.455.2.8
diff -u -r1.455.2.8 comment.module
--- modules/comment.module 10 Aug 2006 08:49:05 -0000 1.455.2.8
+++ modules/comment.module 28 Dec 2006 00:17:05 -0000
@@ -171,7 +171,7 @@
}
function theme_comment_block() {
- $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.subject, c.cid, c.timestamp FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE n.status = 1 AND c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 10);
+ $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.subject, c.cid, c.timestamp FROM {comments} c INNER JOIN {node} n ON n.nid = c.nid WHERE n.status = 1 AND c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 5);
$items = array();
while ($comment = db_fetch_object($result)) {
$items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
@@ -561,7 +561,6 @@
// Allow modules to respond to the updating of a comment.
comment_invoke_comment($edit, 'update');
-
// Add an entry to the watchdog log.
watchdog('content', t('Comment: updated %subject.', array('%subject' => theme('placeholder', $edit['subject']))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
@@ -628,10 +627,10 @@
$edit['name'] = $user->name;
}
- db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
+ db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage,notify) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage'],$edit['notify']);
_comment_update_node_statistics($edit['nid']);
-
+
// Tell the other modules a new comment has been submitted.
comment_invoke_comment($edit, 'insert');
@@ -646,7 +645,10 @@
// redirect the user to the node he's commenting on.
if ($status == COMMENT_NOT_PUBLISHED) {
drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));
+
}
+ else
+ comment_invoke_comment($edit, 'publish');
return $edit['cid'];
}
else {
@@ -1001,6 +1003,7 @@
$operations = comment_operations();
if ($operations[$edit['operation']][1]) {
// extract the appropriate database query operation
+
$query = $operations[$edit['operation']][1];
foreach ($edit['comments'] as $cid => $value) {
if ($value) {
<?php
// $Id$
/**
* Implementation of hook_install().
*/
function comment_notify_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$status[] = db_query("
ALTER TABLE {comments}
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '1'");
break;
case 'pgsql':
$status[] = db_query("
ALTER TABLE {comments}
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '1'");
break;
}
// Set module weight for my module
$status[] = db_query("UPDATE {system} SET weight = 10 WHERE name = 'comment_notify'");
// If there is one FALSE value in the status array, there was an error.
if (array_search(FALSE, $status) !== FALSE) {
drupal_set_message(t('Table installation for the comment_notify module was unsuccessful. The tables may need to be installed by hand.'), 'error');
}
else {
drupal_set_message(t('comment_notify module installed successfully.'));
}
}
// Table creation called in update_1 to allow for the case
// where a user is upgrading from a previous version of
// the comment_notify module that did not use tables.
function comment_notify_update_1() {
comment_notify_install();
}
// Table creation called in update_1 to allow for the case
function comment_notify_update_2() {
// Set module weight for my module
$result = db_query("UPDATE {system} SET weight = 10 WHERE name = 'comment_notify'");
drupal_set_message( $results );
if ($result) {
drupal_set_message(t('comment_notify module weight config update successfully.'));
}
else {
drupal_set_message(t('comment_notify module weight config update unsuccessful.'), 'error');
}
$ret[]=$result;
return $ret;
}
?>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment