You are here

function comment_perm_preprocess_comment in Comment Permissions 6

Process variables for comment.tpl.php.

See also

theme_comment()

File

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

Code

function comment_perm_preprocess_comment(&$variables) {

  // remove edit link
  if (isset($variables['links']) && !user_access('administer comments')) {
    if (!comment_perm_edit_access($variables['node'])) {
      $variables['links'] = preg_replace('|<li class="comment_edit.*?</li>|i', '', $variables['links']);
    }
    if (!comment_perm_access($variables['node'])) {
      $variables['links'] = preg_replace('|<li class="comment_reply.*?</li>|i', '', $variables['links']);
    }
    if (strpos($variables['links'], '<li') === FALSE) {
      $variables['links'] = '';
    }
  }
}