You are here

function comment_og_preprocess_comment in Comment OG 5

File

./comment_og.module, line 18

Code

function comment_og_preprocess_comment(&$variables) {
  $comment = $variables['comment'];

  //load links for current comment
  $links = comment_links($comment, FALSE);
  $group = og_get_group_context();

  // if group context
  if ($group) {

    // remove the reply link for non-group members
    if (!og_is_group_member($group)) {
      unset($links['comment_reply']);
    }

    // we add the Group ID to the URL to determin group admin status later
    if (og_is_group_admin($group)) {
      $links['comment_delete'] = array(
        'title' => t('delete'),
        'href' => "comment/delete/{$comment->cid}/{$group->nid}",
      );
    }
  }

  //reset the links HTML
  $variables['links'] = theme('links', $links);
}