From 4a7be0f2f0f1de9025f26088ba3f085c3f1f926c Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 10 Apr 2007 10:40:40 +0000
Subject: [PATCH] - Patch #134839 by webchick: allow turning of signatures
 site-wide.

---
 CHANGELOG.txt            |  1 +
 modules/user/user.module | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 46b86d067838..cbde25902e43 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -14,6 +14,7 @@ Drupal 6.0, xxxx-xx-xx (development version)
 - Added scripts/drupal.sh to execute Drupal code from the command line. Useful to use Drupal as a framework to build command-line tools.
 - Used the Garland theme for the installation and maintenance pages.
 - Improved handling of teasers in posts.
+- Made signature support optional and made it possible to theme signatures.
 - Added generic language management functionality.
     * Support for right to left scripts.
     * Language detection based on parts of the URL.
diff --git a/modules/user/user.module b/modules/user/user.module
index a47a7b8b7d34..e0738add4611 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1468,7 +1468,7 @@ function user_edit_form($uid, $edit, $register = FALSE) {
   }
 
   // Signature:
-  if (module_exists('comment') && !$register) {
+  if (variable_get('user_signatures', 0) && module_exists('comment') && !$register) {
     $form['signature_settings'] = array(
       '#type' => 'fieldset',
       '#title' => t('Signature settings'),
@@ -2443,6 +2443,19 @@ function user_admin_settings() {
   $form['email']['user_mail_pass_subject'] = array('#type' => 'textfield', '#title' => t('Subject of password recovery e-mail'), '#default_value' => _user_mail_text('pass_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your forgotten password e-mail.') .' '. t('Available variables are:') .' !username, !site, !login_url, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri.');
   $form['email']['user_mail_pass_body'] = array('#type' => 'textarea', '#title' => t('Body of password recovery e-mail'), '#default_value' => _user_mail_text('pass_body'), '#rows' => 15, '#description' => t('Customize the body of the forgotten password e-mail.') .' '. t('Available variables are:') .' !username, !site, !login_url, !uri, !uri_brief, !mailto, !login_uri, !edit_uri.');
 
+  // User signatures.
+  $form['signatures'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Signatures'),
+  );
+  $form['signatures']['user_signatures'] = array(
+    '#type' => 'radios',
+    '#title' => t('Signature support'),
+    '#default_value' => variable_get('user_signatures', 0),
+    '#options' => array(t('Disabled'), t('Enabled')),
+    '#description' => t('Enable signature support.'),
+  );
+
   // If picture support is enabled, check whether the picture directory exists:
   if (variable_get('user_pictures', 0)) {
     $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
@@ -2811,7 +2824,7 @@ function user_forms() {
 function user_comment($comment, $op) {
   // Validate signature.
   if ($op == 'view') {
-    if (!empty($comment->signature)) {
+    if (variable_get('user_signatures', 0) && !empty($comment->signature)) {
       $comment->signature = check_markup($comment->signature, $comment->format);
     }
     else {
-- 
GitLab