Part of the EllisLab Network

Plugin Information

Edit Comments 1.0.3 first_party

Download
Author:
Paul Burdick
Published:
May 05, 2007
Last Updated:
Nov 07, 2007
License:
First Party License
Categories:
Plugins  Comments  
Allows One To Edit Comments Via AJAX

Example Usage

There are four plugin related tags you will have to use in your templates to successfully use the Edit Comments plugin.

1. Create a new template (ex: ‘edit_comment’) in your template group.  Inside that template put the following tag:

{exp:edit_comments:ajax_processing}

This is the page used by the AJAX script to process the edited comment text.

 

2. In the <head> tag of your comments template, put the following tag:

{exp:edit_comments:javascript edit_link='site/edit_comment'}

The edit_link=”” parameter is where you will insert the template_group/template path
for the new template created in step 1.  This tag inserts the javascript used to edit the comment.

 

3. In your {exp:comment:entries} tag, surround the {comment} variable like so.

{exp:edit_comments:wrap_comment comment_id="{comment_id}" author_id="{author_id}"}
{comment}
{
/exp:edit_comments:wrap_comment}

This will put a special wrapper around the comment text so that it will automatically be updated when
the comment is edited.

 

4. Finally, this plugin tag also goes in your {exp:comment:entries} tag and will create
the Edit Comment link that can be clicked by the member who wrote the
comment or by a Super Admin, so that a textarea appears for editing.

{exp:edit_comments:edit_link comment_id="{comment_id}" author_id="{author_id}"}
<div class="posted">[{text}Edit Comment{/text}]</div>
{/exp:edit_comments:edit_link}

The {text}{/text} variable pair is where you will put the text for the Edit Comment link.


That is all you need to do.  Members should be able to edit their own comments and Super Admins should
be able to edit all comments.

Notes

OPTIONS:
At the top of the plugin file is a variable called $time_limit. If you set it to a value above
'0', then members will only be allowed to edit their comment for that number of
minutes after it was originally posted.

IMPORTANT NOTE:
Your comments page cannot be cached with this plugin as we need to know at all times
who is viewing the page so we only show the edit links to the correct members.


================================
Version 1.0.1
================================
Added a $time_limit variable to the plugin file so one can have comment editing for a limited time only.

================================
Version 1.0.2
================================
Fixed a little problem with foreign characters not be sent and saved properly in the database.

================================
Version 1.0.3
================================
Added additional security, encoding EE tags in textarea for editing the comment.