Support » Plugins and Hacks » [Brainstorm] Edit last comment by guest

[Brainstorm] Edit last comment by guest

  • I’ve often found myself posting a comment on someone else’s blog only to realize I made a spelling or code mistake after I’ve submitted it.

    So, I got to thinking. Wouldn’t it be cool if a user could edit their own comments? [edit] Clarification: I’m referring to non-WordPress registered users here. [/edit] I’ve been thinking about it on and off for the past couple days and here’s the features and methods that I’ve come up with. Please, by all means, contribute ideas.

    • Only allow editing for X amount of time.
      Can be turned off to allow editing of any comment (I’d allow like 15 min tho or something personally). This is server-side — just takes current time, subtracts comment time, compares to allowed edit time.
    • Authentication
      Two ideas here. First, create a table that stores the comment ID along with a RANDOM string that is placed in both the DB and a cookie on the user’s machine. This (hopefully) only allows the original poster to edit the post. Exploitable possibly? Not sure.

      Other idea – authentication via IP address. Only allow a user with the IP address matching that of the comment to edit the post. This would only be acceptable for if there was a “short” edit time limit, otherwise someone else could get the IP, the user’s IP address could change, etc.

    • Only allow X edits per comment
      You don’t really want a comment being edited 1000 times, do you?
    • Log changes?
      What if someone were to post a racist comment and then like a minute before their edit time is up, change it to “I like bunnies”. You’d probably never know about the racist comment. So logging, or maybe some slick way of not allowing like erasing of a comment’s content? Dunno. Maybe just allow additions… or strike out any removed content like this. Old comment:

      This is the originla comment. This is a sentence. I msipeled some wrds.

      To like this?

      This is the <del>originla</del> original comment. <del>This is a sentence.</del> I added this sentence. I <del>msipeled</del> mispelled some <del>wrds</del> words.

      [edit] Seems these forums don’t allow <del>, so just use your imagination. [/edit]

      Maybe some styling on any added content.

    Any other thoughts on this and ways of implementing it?

Viewing 14 replies - 1 through 14 (of 14 total)
  • You could ask Shelley at http://weblog.burningbird.net/
    She’s running a fork of WP and has had such a feature which she may care to share ?

    MM, sounds good. I’ll get to work 😉

    if (get_the_comment_author_IP() == $_SERVER['REMOTE_ADDR'] && the_time() < time() + 60*20) { edit_comment_link() }

    There’s a start! I think it’d be damn good as a plugin, or even included in WP.

    Bastard, stealing my plugin idea. 😛 j/k Go for it. 😉

    You’ll produce better results anyway. 🙂

    I’m 95% done. The plugin is only 65 lines! Try it at http://code.jalenack.com/archives/mr-average-blog/ (make a test comment and then edit it)


    LOVERLY, guys! I’ll be waiting for this one, really great!

    Alright, I’ve finished.

    I’ll post a new thread when its out of alpha. This release is for people WHO ARE COMFORTABLE WITH CODE. I want to get kinks out first before truly releasing.

    You can download at http://code.jalenack.com/edit-comments.zip

    Make sure you read the readme carefully. It’s twice as big as the plugin itself 🙂 . Please let me know what you think.

    Nice work Andrew! Looks good so far:)

    ifelse, glad it works well.

    I’ve updated it slightly, installation is a tad cleaner. Any more thoughts?

    Downloaded but not installed, I’ll get to it yet this weekend I hope, and “feedback” you by the first of the week….

    brilliant!! 😀 nice work 🙂

    If your blog isn’t on the same time as your server’s time, there are some serious issues with this plugin. I’ve informed jalenack via the #wordpress IRC channel, but I’ll post them here for anyone else that wants to fix it on their blog.

    Replace both places where $time_ago is set in the plugin file with this:

    $time_ago = time() - date('Z') - strtotime($comment->comment_date_gmt);

    And then in your comments.php file, replace this (or whatever it is):

    $jal_comment = $wpdb->get_row("SELECT comment_content, comment_author_IP, comment_date FROM $wpdb->comments WHERE comment_ID = " . $_GET['jal_edit_comments']);
    $time_ago = time() - strtotime($jal_comment->comment_date);

    with this:

    $jal_comment = $wpdb->get_row("SELECT comment_content, comment_author_IP, comment_date_gmt FROM $wpdb->comments WHERE comment_ID = " . $_GET['jal_edit_comments']);
    $time_ago = time() - date('Z') - strtotime($jal_comment->comment_date_gmt);

    It appears to be working as intended now: http://www.viper007bond.com/archives/2005/08/28/new-comment-features/

    Installed, and it seems to work. However, it generates an error in the admin panel. When I click on “manage” and then click on “comments,” I get the following message:

    fatal error: Cannot redeclare jal_edit_comment() (previously declared in /usr/home/helpdesk/public_html/eviscerati/wp-content/plugins/edit-comments.php:23) in /usr/home/helpdesk/public_html/eviscerati/wp-content/plugins/edit-comments.php on line 23


    It just so happens there’s another file in wp-admin with the same name: edit-comments.php . This caused a clash in the files. Simply deactivate the plugin, change the plugin’s file name to something else, and then reactivate.

    Also, the download in this thread now redirects to the new version. See this official thread for it: http://wordpress.org/support/topic/43385 .. You can check it out at Jalecode.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Brainstorm] Edit last comment by guest’ is closed to new replies.