Commit 45268587 authored by greggles's avatar greggles

synching HEAD with DRUPAL-5 so that I can make a 5.x-2.x branch for a bit...

parent 1897d97f
Installation for Drupal 5.x
This module is currently only supported for 4.7
1. Patch the comment.module at modules/comment/comment.module with the
file comment_notify_patch_to_comment.patch. If you are unsure how to
apply patch files please read http://drupal.org/patch/apply or simply
open the file and manually take the actions that it shows. For Drupal6.x
the patch was accepted and this is no longer necessary.
Installation
Note: When you upgrade Drupal core you will need to re-apply that patch
to keep this module working.
- enable module in Drupal
- after the normal install you need to apply a patch to the core comment.module
2. Enable module on the Administer > Site Building > Modules
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
3. Configure the settings for comments, especially
-comment moderation on/off
-users must leave their contact info (set to yes, or how shall we mail them?)
; $Id$
name = Comment Notify
description = "Comment follow-up e-mail notification for anonymous as well as registered users."
dependencies = comment
<?php
// $Id$
/**
* Implementation of hook_install().
......@@ -9,15 +8,15 @@ function comment_notify_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$status[] = db_query("
$status[] = db_query("
ALTER TABLE {comments}
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '1'");
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '0'");
break;
case 'pgsql':
$status[] = db_query("
$status[] = db_query("
ALTER TABLE {comments}
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '1'");
ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '0'");
break;
}
......@@ -26,28 +25,25 @@ function comment_notify_install() {
// 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');
drupal_set_message(t('Database modifications for the comment_notify module was unsuccessful. The modifications may need to be made 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();
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 );
drupal_set_message($results);
if ($result) {
drupal_set_message(t('comment_notify module weight config update successfully.'));
......@@ -56,9 +52,32 @@ function comment_notify_update_2() {
drupal_set_message(t('comment_notify module weight config update unsuccessful.'), 'error');
}
$ret[]=$result;
$ret[] = $result;
return $ret;
}
// modify default mailtext to contain ! instead of % for placeholders
function comment_notify_update_3() {
// Set module weight for my module
$result = db_query("UPDATE {variable} SET value = replace(value, '%', '!') WHERE name = 'comment_notify_default_mailtext'");
drupal_set_message($results);
if ($result) {
drupal_set_message(t('comment_notify mail text migration successful.'));
}
else {
drupal_set_message(t('comment_notify mail text migration unsuccessful.'), 'error');
}
$ret[]=$result;
return $ret;
}
?>
\ No newline at end of file
/*
* Set the default to 0 for upgrades so users must opt in to get emails.
*/
function comment_notify_update_4(){
$ret = array();
$ret[] = update_sql("ALTER TABLE {comments} MODIFY notify tinyint(1) NOT NULL DEFAULT '0'");
return $ret;
}
\ No newline at end of file
This diff is collapsed.
Index: comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.520.2.12
diff -u -p -r1.520.2.12 comment.module
--- comment.module 7 Nov 2007 08:03:30 -0000 1.520.2.12
+++ comment.module 19 Jan 2008 13:13:33 -0000
@@ -803,6 +803,9 @@ function comment_save($edit) {
if ($edit['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 {
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