--- D:/Install_files/Web/CMS/drupal-modules/authorship-original/authorship/authorship.module Tue Feb 06 20:46:20 2007 +++ D:/Install_files/Web/CMS/drupal-modules/authorship/authorship.module Tue Apr 10 15:16:06 2007 @@ -45,7 +45,7 @@ */ function authorship_form_alter($form_id, &$form) { global $user; - + _authorship_debug("authorship_form_alter(" . $form['#node']->nid . ")"); if ($form_id == 'node_type_form' && isset($form['#node_type'])) { @@ -58,7 +58,7 @@ '#title' => t('The profile variable name used to store the real name'), '#default_value' => variable_get('authorship_real_name_'. $form['#node_type']->type, 'profile_real_name_'. $form['#node_type']->type), '#description' => t('Ensure the value entered here matches the variable '. - 'name that was given to the Real Name vlaue in the '. + 'name that was given to the Real Name value in the '. 'profile module settings area.') ); $form['workflow']['authorship']['authorship'] = array( @@ -84,6 +84,47 @@ } } } + + if(isset($form['#id']) && $form['#id'] == 'comment-form' ) { + if (variable_get('authorship_comment', 0)) { + $row = db_fetch_object(db_query("SELECT authorship FROM {node_authorship} WHERE nid = '%s'", $form['cid']['#value'])); + $authorship = $row->authorship; + + if ($user->uid == 1 || user_access('admin authorship') || user_access('user use authorship')) { + $form['authoring'] = array( + '#type' => 'fieldset', + '#title' => t('Authoring information'), + '#weight' => 9, + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['authoring']['authorship'] = array( + '#type' => 'textfield', + '#title' => t('Authorship display setting'), + '#default_value' => $authorship, + '#description' => t('The name to display as the submitter. '. + 'Leave blank for normal operation') + ); + } + } + } + + if(isset($form['#id']) && $form['#id'] == 'comment-admin-settings' ) { + $form['posting_settings']['authorship_real_name_comment'] = array( + '#type' => 'textfield', + '#title' => t('The profile variable name used to store the real name'), + '#default_value' => variable_get('authorship_real_name_comment', 'profile_real_name_comment'), + '#description' => t('Ensure the value entered here matches the variable '. + 'name that was given to the Real Name value in the '. + 'profile module settings area.') + ); + $form['posting_settings']['authorship_comment'] = array( + '#type' => 'radios', + '#title' => t('Enable authorship module functionality'), + '#default_value' => variable_get('authorship_comment', 0), + '#options' => array(t('Disabled'), t('Enabled')), + ); + } } /* }}} */ @@ -92,13 +133,13 @@ * Implementation of hook_nodeapi() */ function authorship_nodeapi(&$node, $op, $teaser, $page) { - + _authorship_debug("authorship_nodeapi(" . $node->nid . ", $op)"); switch ($op) { case 'load': $sql = "SELECT authorship, profile_real_name ". - "FROM {node_authorship} WHERE nid = %d"; + "FROM {node_authorship} WHERE nid = %d AND cid = 0"; $row = db_fetch_object(db_query($sql, $node->nid)); $node->authorship = $row->authorship; $node->profile_real_name = $row->profile_real_name; @@ -106,7 +147,7 @@ case 'insert': case 'update': db_query("DELETE FROM {node_authorship} WHERE nid = %d", $node->nid); - db_query("INSERT INTO {node_authorship} (nid, authorship, profile_real_name) VALUES (%d, '%s', %d)", + if($node->authorship != "" || $node->profile_real_name != "") db_query("INSERT INTO {node_authorship} (nid, authorship, profile_real_name) VALUES (%d, '%s', %d)", $node->nid, $node->authorship, $node->profile_real_name); break; case 'delete': @@ -123,6 +164,42 @@ break; // end 'view' } // end switch } + +/* {{{ authorship_comment() */ +/** + * Implementation of hook_comment() + */ +function authorship_comment(&$comment, $op) { +//echo "$op
"; print_r($comment); echo "