Most forum systems let you set a limit for how long you can edit a post. This gives you time to fix minor mistakes but not change your words once people have started replying. This one is getting out of scope, so I understand if you won't fix. At the same time, making a seperate module for it may be overkill and this does already deal with editing posts. I'll leave the decision up to you.

Thanks,

Michelle

Comments

snufkin’s picture

hmm comment edit is coming from the comment module itself, i'll probably need to override those functions (callbacks and the actual printed links). I don't know if it fits into the profile of this module, indeed a new module seems a bit overkill, so why not. I'll take a look after the permission based display.

michelle’s picture

Yeah, it's one of those things that is really pushing the scope but similar enough that it's not a total stretch. And it would be nice for forum users to only have to install one module to handle "beyond core" editing issues. Goodness knows there's enough modules to install to make a Drupal forum already. LOL

Thanks for considering it,

Michelle

The Crash’s picture

So can you add this feature to the module Michelle?
as you say making a seperate module for it may be overkill .

expatme’s picture

whats up with drupal not allowing people to edit errors and typos?? its not like an auction where you cant take back a bid LOL

whats the rational in drupal that i have NOT seen in forums and other CMS'es?

michelle’s picture

@The Crash - It's up to the module's maintainer. If you read the issue, you can see we're discussing it.

@expatme - What are you talking about? Drupal doesn't prevent you from edting errors and typos. The whole point of this issue is to allow admins to set a time limit for these edits so people aren't allowed to change their words after many people have commented based on what they originally said.

Michelle

The Crash’s picture

In fact Michelle, I read the issue but I didn't know what do you want?
feature request: That mean you want the module like me , I am not a developer so I can't support you to do any module...I just can wait with you .

michelle’s picture

@The Crash - I'm not sure how to make it any clearer. It's a feature request that I'm asking snufkin to consider adding to this module. I can't do it; I'm not the maintainer and that would be a misuse of my access to just go and add it to the module without his consent.

Michelle

snufkin’s picture

The Crash: as Michelle said. I am the module maintainer, and I am considering adding this feature. Of course any form of support, patch is welcome.

On a sidenote: seeing the feature requests I think it would be a good idea to turn this module into some kind of comment enhancement. Sadly core comment module is not very customizable, moreover its explicitly integrated into the node module too...

arthurf’s picture

I wrote the following quickly for D5 while trying to sketch out some other code. I haven't tested it much, but it should work if you through it in a hook_form_alter and update the $form to D6. Also requires an admin setting. I'll write it up for you in D6 if you want.

<?php

....hook_form_alter.......

  // is this node type time limited?
  if ($offset = variable_get('time_limit_'. $form_id, false)) {
    // set the type of item (comment or node type)
    if ($form_id == 'comment_form') { $type = 'comment'; }
    else {$type = $form['#node']->type; }
    // Now check the user permissions- these are negative permissions rather than positive ones
    if (user_access('time limit '. $type) ) {
      // find the object created time
      if ($type == 'comment' ) {
        $created = $form['#parameters'][1]['timestamp'];         
      }
      else {
        $created = $form['#node']->created;
      }      
      // check the offset (offset is in minutes) against the created time
      if ($created < (time() - (60 * $offset))) {
        drupal_set_message(t('Sorry, the time limit for editing this has run out.'));
        drupal_goto(referer_uri());
      }
    }
  }

?>
aharown07’s picture

I'd also love to see this time limit feature, though this is already a great module.

aharown07’s picture

Anybody got a d6 patch? Or if someone can verify that the D5 patch works, I might eventually muster up the courage to try Coder etc. and port it to D6. It looks about the right size for my first ever conversion to D6.

snufkin’s picture

This is a d6 only module at the moment, what D5 patch do you mean?

aharown07’s picture

The one in #5 that is supposed to time-limit editing

snufkin’s picture

ah #9 you mean. If there is such a need for this feature i'll implement it, I just never assumed it would be really useful for people.

aharown07’s picture

Yes, 9. Thanks. Yeah, it's especially attractive to people who are moving to Drupal from one of the major bulletin board type systems out there. Nice to be able to stabilize the comments after a period by locking them.

snufkin’s picture

I am going to put this feature into the dev version, but I will need people to test it before I push it to be the official version, as I am not a big forum person. Could you help out testing it when its done?

michelle’s picture

@snufkin: I'd be willing to test in a couple of weeks but there's a high probability that I will forget. If you want, you can ping me on IRC about it then.

Michelle

aharown07’s picture

I'll test. Newbie question: how will I know when it's made it into the downloadable Dev version?

Edit: nevermind on the "how will I know" question. I'm assuming the last updated date will change on the 'release notes' page.

snufkin’s picture

The problem with negative permissions is that permissions propagate on. Meaning if you enable that for authenticated users, then all your moderators will be applied too, which is not ideal.

Instead I will create an 'ignore time limit on [type]'. All users will be affected for time limit if you set that up on a content type, but users with this permission will be exempt.

snufkin’s picture

Status: Active » Needs review

Okay so here it is. I don't think that a redirect would be useful, or informative. Instead I disabled the textfields in the comment, and display the error message mentioned in #9.

Please check it out to see if you like it. I don't need this feature, so its up to you how I implement it.

Commit: http://drupal.org/cvs?commit=185656

aharown07’s picture

Ready to test but I can't seem to figure out how to download this.

Edit: nevermind, I think I've got it.

aharown07’s picture

Found a new .module file and a new .inc file, so I put those where they go. So far, I see new settings for permissions, and several new options on the Settings page.
What I don't see is where you set the time limit length. Am I overlooking that somewhere?

Edit: found it.... Content Type -> Comment settings.

snufkin’s picture

Yeah i should make that clearer I think.

aharown07’s picture

OK, I'm getting errors. I think I probably haven't got all the new code in place properly. Are there DB updates also? I only found a new .module file and a .inc file... so I just copies these over my existing files. Probably not the right way to do it.
Anyway, set up permissions, created a post, edited the post. No "edited by" text appeared. And this error appeared repeatedly.

# user warning: Table 'sharpe5_dr6.comment_edited_comments' doesn't exist query: SELECT created FROM comment_edited_comments WHERE cid = 13 in /home/...sites/all/modules/comment_edited/comment_edited.module on line 133.
# user warning: Unknown column 'type' in 'where clause' query: SELECT uid, timestamp FROM comment_edited_data WHERE cid = 13 AND type = 0 in /home/... sites/all/modules/comment_edited/comment_edited.module on line 186.

I do not have the "use template" option enabled in Settings, if that matters.

So I'm guessing I need a new .install file too? To update/make new tables in the DB?

snufkin’s picture

Ah I probably forgot to add the upgrade functions indeed, thanks!

snufkin’s picture

Did you run the update.php? The comment_edited_comments table should be on the update_6101 step, the type column should be added on the update_6102 step.

snufkin’s picture

I fixed up the update path for the database. Now the only thing I might need to worry about is pre-populating the new table, but as I think about it i might as well just leave it empty and let the new edits populate it. I am talking about the extra information (edit type, created time).

aharown07’s picture

Tks for the update. Will test when you have something ready again.

snufkin’s picture

There is ready dev tarball, it has fixed database upgrades in it, so it would be nice to test. Just dont forget to run update.php after you installed the new version!

aharown07’s picture

I'm still a bit foggy on how the whole cvs thing works... can you post me a link to the tarball. I'll be sure I have all the files that way.

michelle’s picture

http://drupal.org/node/350131

You can also find it linked to on the project page. ;)

Michelle

aharown07’s picture

Ah... it's an updated dev. That I can do! ... last time I ended up on some kind of cvs screen trying to find the newest versions of the project files and wasn't sure I had them all. Maybe I just didn't wait long enough? Anyway, thanks for the link.

aharown07’s picture

OK, installed (ran update.php), tested a bit. Before I could edit a comment, I went to an existing test thread (as a regular authenticated user). As soon as I entered the thread, notice appeared onscreen: "Sorry, the time limit for editing this has run out." ... and it doesn't allow creating comments at all.

However, doesn't do this on all threads. It seems to have someting to do w/the content type. I have a custom content type 'article' I used in forums. The message does not appear on these.
Checked access control for forum post content type... seems correct. So will have to study this some more.

Also rebuilt permissions and flushed caches. Still getting this message and can't post comments.
Can create forum topics, but can't post comments on them.

In the 'article' content type threads where I can post comments, the "edited by" info does not appear when I edit. Out of time for tonight, but when I get a chance will look closely at what's the same vs. different in the permissions on these content types (I am using content access for role-level permissions on content types).

aharown07’s picture

Checked out access control on both content types ('article' and 'forum post') and they are identical. And I have test posts of both types in the same forum.
What's different is that I didn't have a time limit keyed in under comment settings for 'article' content type.
Entered a value, and now it's behavior matches that of 'forum post.'

Not sure what other info would be helpful.

aharown07’s picture

Anybody else having trouble w/the time limit?

snufkin’s picture

I think there was a bug in the code related to the condition check for the time limit. 0 time limit was interpreted as valid time limit, I think I fixed it, tested locally with other content types and looked fine. Commit just went in, if you could take a look at the new tarball when its updated it would be great.

For the time being I added a drupal message so when you are editing comments on a topic that has valid time limit enabled it says so, this is a debugging help and it will be removed later.

aharown07’s picture

It's still behaving as before... except that now it says "time limit enabled" first, then just below it "sorry the time limit for editing this has run out"
As before, the "has run out" message appears immediately when the user enters the thread... and the comment entry form does not allow input.

snufkin’s picture

what is the value for the time limit on the content type on which the reply is that you try to edit? Its the content-type settings form -> comment settings, top of the list.

simonmd’s picture

Category: feature » bug

Same here, inmediately after entering the edit form the "has run out" message appears and no editing is allowed. I've tried with 90 second timeouts configured on my content type page.

snufkin’s picture

aah i think i understood the problem now: you had the comment entry form displayed within the thread.

Same here, inmediately after entering the edit form the "has run out" message appears and no editing is allowed. I've tried with 90 second timeouts configured on my content type page.

Well that is the intended behaviour, if you click on edit comment on an existing thread where you set up time limit, that limit will be checked from the last update time of that comment, and thus if its older than 90 sec you wont be able to edit it.

Having said that now i see that I had a bug so that the time limit also applied to the NEW comment forms. This is fixed now.

aharown07’s picture

That makes sense. Will test as soon as the commit is avail.

aharown07’s picture

Time limit seems to be working properly now. Allows when it should. When time expires, the "time has run out" shows.

One problem: the "last edited..." info is not getting appended to the comments.
I do not have "use tmplate variable" enabled, so that may be working, but the default edit msg in the comment is not working for me.

Edit: my mistake. Forgot to give test user "view edit message" permission. It's working fine.

snufkin’s picture

Title: Time limited editing » Write documentation (code and drupal.org) for 1.2 release
Status: Needs review » Needs work

Great. Now all we need is some fine documentation so the users dont get scared away from the new features and know how to use them. Updating the title accordingly.

aharown07’s picture

Possible problem w/time limited editing: on latest dev version, edits by user 1 don't seem to get the "edited by..." Not sure why. Module is configured to show all edits. Not a big deal, probably since most ppl aren't going to use user 1 account for moderating and stuff.

snufkin’s picture

That is normal and by design. user 1 is exempt from all the access checks, so i would have to hardcode some solution for that user, moreover I think it would encourage bad admin behaviour (users should not use in general their site as user 1).

aharown07’s picture

That makes sense. Thanks.

snufkin’s picture

Status: Needs work » Fixed

README.txt added, new release created.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.