? user_signatures_1.patch Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.391 diff -u -r1.391 comment.module --- modules/comment.module 21 Nov 2005 08:32:31 -0000 1.391 +++ modules/comment.module 22 Nov 2005 04:17:43 -0000 @@ -290,21 +290,6 @@ } /** - * Implementation of hook_user(). - * - * Provides signature customization for the user's comments. - */ -function comment_user($type, $edit, &$user, $category = NULL) { - if ($type == 'form' && $category == 'account') { - // when user tries to edit his own data - $form['comment_settings'] = array('#type' => 'fieldset', '#title' => t('Comment settings'), '#collapsible' => TRUE, '#weight' => 4); - $form['comment_settings']['signature'] = array('#type' => 'textarea', '#title' => t('Signature'), '#default_value' => $edit['comment_settings']['signature'], '#description' => ('Your signature will be publicly displayed at the end of your comments.')); - - return $form; - } -} - -/** * Menu callback; presents the comment settings page. */ function comment_configure() { @@ -799,7 +784,7 @@ if ($cid) { // Single comment view. - $result = db_query('SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users', $cid, COMMENT_PUBLISHED); + $result = db_query('SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.score, c.users FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d AND c.status = %d GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users', $cid, COMMENT_PUBLISHED); if ($comment = db_fetch_object($result)) { $comment->name = $comment->uid ? $comment->registered_name : $comment->name; @@ -809,9 +794,9 @@ else { // Multiple comment view - $query .= "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND c.status = %d"; + $query .= "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND c.status = %d"; - $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread'; + $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.signature, u.picture, u.data, c.score, c.users, c.thread'; /* ** We want to use the standard pager, but threads would need every @@ -1166,7 +1151,7 @@ $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => $edit['subject']); } - $form['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE + $form['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'], '#required' => TRUE ); $form = array_merge($form, filter_form($node->format)); Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.551 diff -u -r1.551 node.module --- modules/node.module 21 Nov 2005 18:10:26 -0000 1.551 +++ modules/node.module 22 Nov 2005 04:17:43 -0000 @@ -361,10 +361,10 @@ // Retrieve the node. if ($revision) { - $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond), $revision)); + $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.signature, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond), $revision)); } else { - $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond))); + $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.signature, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond))); } if ($node->nid) { Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.533 diff -u -r1.533 user.module --- modules/user.module 21 Nov 2005 18:36:12 -0000 1.533 +++ modules/user.module 22 Nov 2005 04:21:12 -0000 @@ -1155,25 +1155,90 @@ function user_edit_form($uid, $edit) { // Account information: - $form['account'] = array('#type' => 'fieldset', '#title' => t('Account information'), '#weight' => 0); - $form['account']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $edit['name'], '#maxlength' => 55, '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), '#required' => TRUE); - $form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#maxlength' => 55, '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE); - $form['account']['pass'] = array('#type' => 'item', '#title' => t('Password'), '#value' => ' ', '#required' => true); + $form['account'] = array( + '#type' => 'fieldset', + '#title' => t('Account information'), + '#weight' => 0, + ); + $form['account']['name'] = array( + '#type' => 'textfield', + '#title' => t('Username'), + '#default_value' => $edit['name'], + '#maxlength' => 55, + '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'), + '#required' => TRUE, + ); + $form['account']['mail'] = array( + '#type' => 'textfield', + '#title' => t('E-mail address'), + '#default_value' => $edit['mail'], + '#maxlength' => 55, + '#description' => t('Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), + '#required' => TRUE, + ); + $form['account']['pass'] = array( + '#type' => 'item', + '#title' => t('Password'), + '#value' => ' ', + '#required' => true, + ); if (user_access('administer users')) { - $form['account']['status'] = array('#type' => 'radios', '#title' => t('Status'), '#default_value' => $edit['status'], '#options' => array(t('Blocked'), t('Active'))); + $form['account']['status'] = array( + '#type' => 'radios', + '#title' => t('Status'), + '#default_value' => $edit['status'], + '#options' => array(t('Blocked'), t('Active')), + ); } if (user_access('administer access control')) { - $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys($edit['roles']), '#options' => user_roles(1), '#description' => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), '#required' => TRUE); - } + $form['account']['roles'] = array( + '#type' => 'checkboxes', + '#title' => t('Roles'), + '#default_value' => array_keys($edit['roles']), + '#options' => user_roles(1), + '#description' => t('Select at least one role. The user receives the combined permissions of all of the selected roles.'), + '#required' => TRUE, + ); + } + + // Signature: + $form['signature'] = array( + '#type' => 'fieldset', + '#title' => t('Signature settings'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['signature']['signature'] = array( + '#type' => 'textarea', + '#title' => t('Signature'), + '#default_value' => $edit['signature'], + '#description' => t('Your signature will be publicly displayed at the end of your posts and comments where the administrator has enabled them.'), + ); // Picture/avatar: if (variable_get('user_pictures', 0)) { - $form['picture'] = array('#type' => 'fieldset', '#title' => t('Picture'), '#weight' => 1); + $form['picture'] = array( + '#type' => 'fieldset', + '#title' => t('Picture'), + '#weight' => 1, + ); if ($edit['picture'] && ($picture = theme('user_picture', array2object($edit)))) { - $form['picture']['current_picture'] = array('#type' => 'markup', '#value' => $picture); - $form['picture']['picture_delete'] = array('#type' => 'checkbox', '#title' => t('Delete picture'), '#description' => t('Check this box to delete your current picture.')); - } - $form['picture']['picture'] = array('#type' => 'file', '#title' => t('Upload picture'), '#size' => 48, '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', '')); + $form['picture']['current_picture'] = array( + '#type' => 'markup', + '#value' => $picture, + ); + $form['picture']['picture_delete'] = array( + '#type' => 'checkbox', + '#title' => t('Delete picture'), + '#description' => t('Check this box to delete your current picture.'), + ); + } + $form['picture']['picture'] = array( + '#type' => 'file', + '#title' => t('Upload picture'), + '#size' => 48, + '#description' => t('Your virtual face or picture. Maximum dimensions are %dimensions and the maximum size is %size kB.', array('%dimensions' => variable_get('user_picture_dimensions', '85x85'), '%size' => variable_get('user_picture_file_size', '30'))) .' '. variable_get('user_picture_guidelines', ''), + ); } return $form; @@ -1752,18 +1817,92 @@ function user_configure() { // User registration settings. - $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings')); - $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.'))); - $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.')); + $form['registration'] = array( + '#type' => 'fieldset', + '#title' => t('User registration settings'), + ); + $form['registration']['user_register'] = array( + '#type' => 'radios', + '#title' => t('Public registrations'), + '#default_value' => variable_get('user_register', 1), + '#options' => array(t('Only site administrators can create new user accounts.'), + t('Visitors can create accounts and no administrator approval is required.'), + t('Visitors can create accounts but administrator approval is required.')), + ); + $form['registration']['user_registration_help'] = array( + '#type' => 'textarea', + '#title' => t('User registration guidelines'), + '#default_value' => variable_get('user_registration_help', ''), + '#description' => t('This text is displayed at the top of the user registration form. It\'s useful for helping or instructing your users.'), + ); + + // User signature settings. + $form['signature'] = array( + '#type' => 'fieldset', + '#title' => t('User signature settings'), + ); + $defaults = array_keys(variable_get('signature_node_types', array()), '1'); + $form['signature']['signature_node_types'] = array( + '#type' => 'checkboxes', + '#title' => t('Types'), + '#options' => node_get_types(), + '#default_value' => $defaults, + '#description' => t('Selected content types will display signatures at the bottom of all posts and comments'), + ); + $form['signature']['signature_template'] = array( + '#type' => 'textarea', + '#title' => t('Signature template'), + '#default_value' => variable_get('signature_template', '--