You are here

function commentaccess_form_alter in Comment Access 7

Implementation of hook_form_alter().

Adds the comment administration fields to the node edit form.

File

./commentaccess.module, line 260
Provides users with permissions for comments on nodes they own.

Code

function commentaccess_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && isset($form['#node'])) {
    global $user;
    $type = $form['type']['#value'];
    if ($type . '_node_form' == $form_id) {
      $form['comment_settings']['#access'] |= $user->uid == $form['#node']->uid && user_access("administer comments on own {$type}");
    }
  }
}