You are here

function comment_perm_permission in Comment Permissions 7

Same name and namespace in other branches
  1. 7.2 comment_perm.module \comment_perm_permission()

Implementation of hook_permission().

File

./comment_perm.module, line 31
Module to control commenting permissions by role and by node type.

Code

function comment_perm_permission() {
  $perms = array();
  $types = variable_get('comment_perm_node_types', array());
  if (is_array($types)) {
    foreach ($types as $type) {
      if ($type) {
        $perms[$type . ': administer comment settings on any ' . $type . ' content'] = array(
          'title' => t("%type: administer comment settings on any %type content", array(
            '%type' => $type,
          )),
        );
        $perms[$type . ': administer comment settings on own ' . $type . ' content'] = array(
          'title' => t("%type: administer comment settings on own %type content", array(
            '%type' => $type,
          )),
        );
        $perms[$type . ': comment on any ' . $type . ' content'] = array(
          'title' => t("%type: comment on any %type content", array(
            '%type' => $type,
          )),
        );
        $perms[$type . ': comment without approval on any ' . $type . ' content'] = array(
          'title' => t("%type: comment without approval on any %type content", array(
            '%type' => $type,
          )),
        );
        $perms[$type . ': comment without approval on own ' . $type . ' content'] = array(
          'title' => t("%type: comment without approval on own %type content", array(
            '%type' => $type,
          )),
        );
        $perms[$type . ': edit own comments on ' . $type . ' content'] = array(
          'title' => t("%type: edit own comments on %type content", array(
            '%type' => $type,
          )),
        );
      }
    }
  }
  return $perms;
}