Index: usercomment.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/usercomment/usercomment.module,v
retrieving revision 1.5.2.5
diff -u -p -r1.5.2.5 usercomment.module
--- usercomment.module	30 Jan 2009 23:49:09 -0000	1.5.2.5
+++ usercomment.module	7 Feb 2009 15:10:38 -0000
@@ -137,7 +137,7 @@ function usercomment_menu() {
     'page callback' => 'usercomment_approve',
     'page arguments' => array(2),
     'access callback' => usercomment_menu_access,
-    'access arguments' => array('approve'),
+    'access arguments' => array('approve', 2),
   );
   return $items;
 }
@@ -145,19 +145,26 @@ function usercomment_menu() {
 /**
  * Define menu access permission
  */
-function usercomment_menu_access($op) {
+function usercomment_menu_access($op, $cid = NULL) {
   global $user;
-  $cid = arg(2);
-  if (!empty($cid)) {
+
+  if (is_numeric($cid)) {
    $comment = _comment_load($cid);
    $node = node_load($comment->nid);
- }
+  }
+
+  if (user_access('administer comments')) {
+    return TRUE;
+  }
+
   switch ($op) {
     case 'approve':
-      return ($user->uid == $node->uid || user_access('administer comments', $user));
+      return ($user->uid == $node->uid);
     case 'delete':
       return ($user->uid == $node->uid || usercomment_access_check($comment->cid));
   }
+
+  return FALSE;
 }
 
 /**
@@ -177,19 +184,34 @@ function usercomment_nodeapi(&$node, $op
 }
 
 /**
- * Implementation of hook_perm()
+ * Implementation of hook_perm().
  */
 function usercomment_perm() {
-  $perms = array();
-  $perms[] = 'skip author\'s approval queue when posting comments';
-  foreach  (node_get_types() as $node) {
+  $perms = array(
+    "skip author's approval queue when posting comments",
+    'administer comments on own content',
+  );
+
+  foreach (node_get_types() as $node) {
     $perms[] = 'delete comments on own '. check_plain($node->type) .' content';
     $perms[] = 'approve comments on own '. check_plain($node->type) .' content';
   }
+
   return $perms;
 }
 
 /**
+ * Implementation of hook_form_alter().
+ */
+function usercomment_form_alter(&$form, $form_state, $form_id) {
+  global $user;
+
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
+    $form['comment_settings']['#access'] |= ($user->uid == $form['#node']->uid && user_access('administer comments on own content'));
+  }
+}
+
+/**
  * Implementation of hook_user()
  */
 function usercomment_user($op, &$edit, &$account, $category = NULL) {
