Just a thought... When the time limit is set on editing a comment, instead of disabling the comment form and adding a user message, why not just disable the edit link from within the comment. Having the edit link still visible gives the user the impression that he or she can still edit the comment.

Comments

snufkin’s picture

Thats a valid point, I will look into this.

snufkin’s picture

Status: Active » Postponed

I sadly have to postpone this until #374463: Alter comment links. gets resolved, there is a limitation within the core's link override handling regarding comments.

walker2238’s picture

Yeah thought so, thats actually how I found this module. Thanks for the quick response.

mr.alinaki’s picture

There are some patches for D6 in this issue. If you patch comment.module, you can use this function:

function comment_edited_link_alter(&$links, $comment) {
  if (is_array($links) && isset($links['comment_edit'])) {
    $node = node_load($comment->nid);
    $ignore = user_access('ignore time limit on '. $node->type);
    if (!$ignore) {
      $now = time();
      $created = $comment->timestamp;
      if (empty($created)) {
        $created = $now;
      }
      $limit = variable_get('comment_edited_timelimit_'. $node->type, 0);
      if ($now > ($created + $limit)) {
        unset($links['comment_edit']);
      }
    }
  }
}
walker2238’s picture

Yeah I basically something along those lines already. Actually I just hacked it. All I was looking for was a way to remove and prevent users from editing a comment they made after 5 minutes of initial post.

I just hacked the comment_link function, seems to work.

 if (comment_access('edit', $comment) && $comment->timestamp > (time() - (300))) {
$links['comment_edit'] = array(
'title' => t('edit'),
'href' => "comment/edit/$comment->cid"
);
}

However you say that there are some patches, do you have the links by chance? I think this module could really do a lot of neat things if it wasn't for that pesky function.

mr.alinaki’s picture

walker2238’s picture

Sweet, thanks for your help. Hope this becomes core.

ximo’s picture

#374463: Alter comment links. has finally been committed to Drupal 6 core! Now we just have to wait for 6.16 to be released. Someone please hack Drupal 6 and expose a huge security hole to get the security team going... :)

On a more serious note... I consider it safe to patch core comment.module with the patch that got committed (#39) for now, but this module would have to get working code to support this change, and you'd have to run the dev release until a stable release is out.

snufkin’s picture

Project: Comment edited » Advanced comment
Version: 6.x-1.x-dev »
Status: Postponed » Active

This is now assigned to the advanced comment module as it really doesn't fit under the comment_edited namespace.