From 5a89fef970b26af6eb1d970ad8a9a5876e4126df Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 16 Oct 2009 13:20:16 +0000 Subject: - Patch #275368 by michaelfavia, sun, mattconnolly: allow disabling comment preview + unify with node preview settings. --- modules/comment/comment.install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'modules/comment/comment.install') diff --git a/modules/comment/comment.install b/modules/comment/comment.install index 272c50944..640b54f7f 100644 --- a/modules/comment/comment.install +++ b/modules/comment/comment.install @@ -174,6 +174,26 @@ function comment_update_7008() { db_add_index('comment', 'comment_nid_language', array('nid', 'language')); } +/** + * Update preview setting variable to use new constants + */ +function comment_update_7009() { + foreach (node_type_get_types() as $type => $object) { + // There were only two comment modes in the past: + // - 1 was 'required' previously, convert into DRUPAL_REQUIRED (2). + // - 0 was 'optional' previously, convert into DRUPAL_OPTIONAL (1). + $original_preview = variable_get('comment_preview_' . $type, 1); + if ($original_preview) { + $preview = DRUPAL_REQUIRED; + } + else { + $preview = DRUPAL_OPTIONAL; + } + variable_set('comment_preview_' . $type, $preview); + } + return array(); +} + /** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. -- cgit v1.2.3