LG Quarantine v1.0.0 An ExpressionEngine comment and weblog entry peer review module and extension.
Download LG Quarantine v1.0.0 Table of contentsFeatures
LG Quarantine is a MSM compatible community powered, peer review, comment and weblog entry monitoring system.
Weblog comments and entires can be flagged by users as innapropriate. Once a pre-determined number of flags have been thrown the comment or entry is "quarantined" and its status is updated to closed.
Quarantined comments and entries are monitored through a powerful administration panel. Flagged and quarantined comments and entries can be re-openned, edited or deleted by the site administrator.
Screenshots
The popup modal is just a simple example of how a developer can extend LG Quarantines functionality. It's important to note that the modal screenshots are just an example and that LG Quarantine does not include or force the developer to use predefined styles.
Requirements
LG Quarantine requires ExpressionEngine 1.6+. New version update notifications will only be displayed if LG Addon Updater is installed.
LG Quarantine also requires jQuery 1.2.6+ for comment and entry administration.
Installation
The LG Quarantine .zip download contains an extension, module and language directory. To install LG Quarantine follow the instructions below:
- Download the latest version of LG Quarantine
- Extract the .zip file to your desktop
- Copy extensions/ext.lg_quarantine_ext.php file to your /system/extensions directory
- Copy the language/english/lang.lg_quarantine_ext.php file to your /system/languages/english directory
- Copy the modules/lg_quarantine directory to your /system/modules directory
- Open the Modules page and install the LG Quarantine Module
- Open the Extension Manager
- Enable Extensions if not already enabled
- Enable the extension
- Configure the extension settings
Configuration
LG Quarantine has quite a few configuration options but all of them are fairly simple. The following configuration settings must be set on a per site basis:
- Extension Access
- Member flagging preferences
- Quarantine Defaults
- Notification Templates
- AJAX Server Responses
- Scripts
- Check for updates
Extension Access
Enable LG Quarantine extension for this site? [required]
Yes|No
Enabling the addon will allow entries and comments to be quarantined.
Member flagging preferences
Flagging of entries / comments can be restricted to certain member groups. You can also choose if a member can flag an article more than once and how the number of their flags will be calculated.
Which groups are allowed to flag?
Assign flagging permissions to member groups. These groups will be able to flag comments and entries.
Which groups are allowed to automatically quarantine?
Assigned member groups will be able to override the flagging count and send a comment or entry straight to quarantine. This is useful for super admins and site editors.
Can site visitors flag an entry / comment more than once?
Yes|No
It is possile to allow users to flag an entry more than once. This is not advised as a single user could quarantine an entry regardless of the flag count.
Check IP Address?
Yes|No
Check the users IP agaisnt existing flags to see if this was a multiple flag.
Check cookies?
Yes|No
Check the cookies agaisnt existing flags to see if this was a multiple flag.
Check Member ID
Yes|No
Check the users member id agaisnt existing flags to see if this was a multiple flag.
Quarantine Defaults
An entry or comment is quarantined once a certain number of 'flags' have been thrown. Comments will be set to closed and entries will be set to a default entry status unless the quarantine_status parameter has been set.
Number of flags before a comment is quarantined
Yes|No
After this many flags the comment will be quarantined and it's status set to closed.
Number of flags before an entry is quarantined
Yes|No
After this many flags the entry will be quarantined and it's status set to the default entry status unless the quarantine_status parameter has been set.
Status of quarantined entries
closed
When an entry has been quarantined it's status is changed to this setting. You may not want to close the entry completely but rather chnage its visual style or add a note based on its status.
Flag Types
Personal abuse
Off topic
Legal issue
Trolling
Hate speech
Offensive/Threatening language
Copyright
Spam
Other
When an entry is flagged a flag type can be set. Flag types generally appear as a select list in the submission form. Enter each flag type on a new line.
Notification Templates
Once an entry or comment has been quarantined it is possible to send an email to the site administrator or author of the entry/comment.
The following tags will be replaced inside the both entry and comment templates:
{entry_type}: Either 'entry' or 'comment'{entry_id}: The quarantined entry_id or comment_id{weblog_id}: The weblog id{entry_title}: The entry title{author_name}: The author name{author_email}: The author email{flags}: The number of times this entry/comment has been flagged{quarantine_count}: The number of time the entry/comment has been quarantined{edit_entry_url}: The url to edit the entry in your admin panel{edit_comments_url}: The url to an entries comments in your admin panel{original_status}: The original entry status{quarantine_status}: The new quarantined status
The following tags are also available in comment notifications:
{edit_comment_url}: The url to edit the comment in your admin panel
Emails are either sent as Plain Text or HTML based on your email configuration preferences.
Admin Notification Templates
Send the site administrator a notification template when an entry/comment is quarantined?
Yes|No
The emails of the administrators you wish to notify.
you@yourwebsite.com, me@mywebsite.com, admin@theirwebsite.com
Admin entry notification subject
An entry has been quarantined on {site_name}
The email subject line for quarantined entry notifications.
Admin entry notification template
Hi,
An entry titled '{entry_title}' has been quarantined and its status changed from
{original_status} to {quarantine_status} on {site_name}.
Edit this entry: {edit_entry_url}
The email template.
Admin comment notification subject
A comment has been quarantined on {site_name}
The email subject line for quarantined comment notifications.
Admin entry notification template
Hi,
The following comment made by {author_name} has been quarantined and its status changed from
{original_status} to {quarantine_status} on {site_name}.
The comment:
{comment}
Edit this comment: {edit_comment_url}
The email template.
Author Notification Templates
Send the author a notification template when an entry/comment is quarantined?
Yes|No
Author entry notification subject
Your entry has been quarantined on {site_name}
The email subject line for quarantined entry notifications.
Admin entry notification template
Hi {author_name},
An entry you published titled '{entry_title}' has been quarantined and its status changed from
{original_status} to {quarantine_status} on {site_name}.
The email template.
Author comment notification subject
Your comment has been quarantined on {site_name}
The email subject line for quarantined comment notifications.
Admin entry notification template
Hi {author_name},
An comment you made on the entry '{entry_title}' has been quarantined and its status changed from
{original_status} to {quarantine_status} on {site_name}.
Your comment:
{comment}
The email template.
AJAX Server Responses
If the quarantine form is submitted via ajax the server will respond with either of the two messages below. Any of the notification template variables above will be replaced in the server response.
Entry / comment quarantined
The {entry_type} you have flagged has been quarantined. Thankyou
The string returned from the server when a comment or entry is quarantined using ajax.
Flag added
Thanks for flagging this {entry_type}.
The string returned from the server when a comment or entry is flagged using ajax.
Scripts
jQuery Core v1.2.6
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
LG Data Matrix requires jQuery Core v1.2.6+ for the extension settings to function correctly.
Updates
Check for updates?
Yes|No
LG Quarantine can call home and check for recent extension updates. This feature requires LG Addon Updater.
Usage
Ok now this bad boy is setup we can actually start using it!
There is only one tag pair used to flag and quarantine entries and comments; {exp:lg_quarantine}. This tag pair has two required parameters entry_id and entry_type.
The {exp:lg_quarantine} tag pair renders a form that is submitted with an optional reason and the flog is recorded. A form is used as a security measure to stop search engines and spiders flagging entries. Unfortunatley this does incur some extra processing but it should only be noticable on entries with hundreds of comments on the one page.
For quick and sexy entry and comment flagging see Flagging a entries and comments using ajax below.
Flagging an entry
The code example below is a very simple example of adding a quarantine form to an entry.
{exp:weblog:entries limit="1"}
<h1>{title} - {status}</h1>
{exp:lg_quarantine:form entry_type='entry' entry_id='{entry_id}'}
{if can_flag}
<p>{if has_flagged}You have already flagged this entry, but you can flag it again.{/if}</p>
{quarantine_form}
<p>Reason: <select name='flag_type'>
<option value=''>-- Please Choose --</option>
{flag_types}
</select></p>
<p>Comment: <textarea name='comment' rows='3' cols='20'></textarea></p>
<p>Email: <input type='text' name='email' value='{logged_in_email}' /></p>
<p><input type='submit' value='Flag as inappropriate' /></p>
{if can_quarantine}
<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?
{/if}
{/quarantine_form}
{if:else}
<p>{if has_flagged}
Sorry, you have already flagged this entry.
{if:else}
You don't have permission to flag this entry.
{/if}</p>
{/if}
{/exp:lg_quarantine:form}
{/exp:weblog:entries}
Flagging a comment
The code example below is a very simple example of adding a quarantine form to a comment.
The differences between entry flagging and comment flagging are minimal. The only difference is that when flagging a comment the comment_id must be passed to the entry_id parameter and the entry_type parameter must be set to comment.
{exp:weblog:entries limit="1"}
<h1>{title} - {status}</h1>
<h2>Comments</h2>
{exp:comment:entries sort="asc" limit="20"}
{comment}
{exp:lg_quarantine:form entry_type='comment' entry_id='{comment_id}'}
{if can_flag}
<p>{if has_flagged}You have already flagged this entry, but you can flag it again.{/if}</p>
{quarantine_form}
<p>Reason: <select name='flag_type'>
<option value=''>-- Please Choose --</option>
{flag_types}
</select></p>
<p>Comment: <textarea name='comment' rows='3' cols='20'></textarea></p>
<p>Email: <input type='text' name='email' value='{logged_in_email}' /></p>
<p><input type='submit' value='Flag as inappropriate' /></p>
{if can_quarantine}
<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?
{/if}
{/quarantine_form}
{if:else}
<p>{if has_flagged}
Sorry, you have already flagged this entry.
{if:else}
You don't have permission to flag this entry.
{/if}</p>
{/if}
{/exp:lg_quarantine:form}
{/exp:comment:entries}
{/exp:weblog:entries}
Flagging a entries and comments using ajax
Flagging entries and comments with AJAX is a relativley simple exercise. The basic steps are summarised below:
- Create a new template groups called quarantine
- Edit the index template
- Inside the template create a simple
{exp:lg_quarantine:form}form (see exmpale template below) - Add a link to each comment that triggers triggers a GET request to the url http://mysite.com/index.php?quarantine/index/2/entry. In the previous url {segment_3} is the entry or comment id and {segment_4} is the entry type.
- Submit the form through an AJAX POST request and replace the existing form with the server response
Personally I have been using the Shadowbox Media Viewer javascript library to load the form in an overlay and then submitting the form using a jQuery AJAX POST.
My quarantine/index template is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div id="content">
{exp:lg_quarantine:form entry_type="{segment_4}" entry_id="{segment_3}" form_id="quarantine_form"}
{if can_flag}
{if has_flagged}<p>You have already flagged this entry, but you can flag it again.</p>{/if}
{quarantine_form}
<fieldset>
<div class="select">
<label for="flag-reason">Why are you flagging this {segment_4}?</label>
<select name="flag_type" id="flag-reason">
<option value="">-- Please Choose --</option>
{flag_types}
</select>
</div>
<div class="textarea">
<label for="flag-comment">Comment:</label>
<textarea id="flag-comment" name="comment"></textarea>
</div>
{if not_logged_in}
<div class="text">
<label for="flag-email">Your email:</label>
<input type="text" name="email" id="flag-email" value="" />
</div>
{/if}
{if can_quarantine}
<div class="checkbox">
<label for='auto-quarantine'>
Auto quarantine this {segment_4}? <input type="checkbox" name="auto_quarantine" value="y" />
</label>
</div>
{/if}
<div class="buttons">
<input type="submit" value="Flag as inappropriate" />
</div>
</fieldset>
{/quarantine_form}
{if:else}
<p>{if has_flagged}Sorry, you have already flagged this entry.{if:else}You don not have permission to flag this entry.{/if}</p>
{/if}
{/exp:lg_quarantine:form}
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$('#quarantine-form').ajaxForm({ target: '#content' });
</script>
</body>
</html>
Tag Reference
{exp:lg_quarantine}
LG Quarantine is implemented using a single tag pair. It has the following:
Parameters
The primary tag pair has the following parameters:
- entry_id=
- entry_type=
- form_class=
- form_id=
- form_name=
- notify_admin_emails=
- notify_admins=
- notify_author=
- quarantine_count=
- quarantine_status=
- return=
- return_if_quarantined=
entry_id= [required]
entry_id="{entry_id}" or entry_id="{comment_id}"
The id of the entry or comment that is being flagged.
entry_type= [required]
entry_type="entry" or entry_type="comment"
The type of being flagged. This can be either one of two values, "entry" or "comment".
form_class= [optional]
form_class="my-form-class"
The value for the generated forms class attribute.
form_id= [optional]
form_class="my-form-id"
The value for the generated forms id attribute.
form_name= [optional]
form_class="my-form-name"
The value for the generated forms name attribute.
notify_admin_emails= [optional]
notify_admin_emails="me@mysite.com, you@yoursite.com, them@theirsite.com"
A comma seperated list of admins that will be notified if an entry or comment is flagged.
notify_admins= [optional]
notify_admins="y" or notify_admins="n"
Notify admins when a new flag is thrown.
notify_author= [optional]
notify_author="y" or notify_author="n"
Notify author when a new flag is thrown.
quarantine_count= [optional]
quarantine_count="5"
The number of flags before an entry or comment is quarantined.
quarantine_status= [optional]
quarantine_status="quarantined"
The status given to a quarantined entry. Comments will always be set to closed.
return= [optional]
return="{comment_entry_id_auto_path}"
The path the user will be redirected to if an entry or comment is flagged but not quarantined.
return_if_quarantined= [optional]
return_if_quarantined="{path="quarantine/success"}"
The path the user will be redirected to if an entry or comment is flagged and quarantined. Generally we cannot send the user back to the same entry because its status will be set to closed.
Variable Pairs
LG Quarantine has one variable pair tag. {quarantine_form}.
{quarantine_form} ... {/quarantine_form} [required in {exp:lg_quarantine:form}]
{exp:weblog:entries limit="1"}
<h1>{title} - {status}</h1>
{exp:lg_quarantine:form entry_type='entry' entry_id='{entry_id}'}
{if can_flag}
<p>{if has_flagged}You have already flagged this entry, but you can flag it again.{/if}</p>
{quarantine_form}
<p>Reason: <select name='flag_type'>
<option value=''>-- Please Choose --</option>
{flag_types}
</select></p>
<p>Comment: <textarea name='comment' rows='3' cols='20'></textarea></p>
<p>Email: <input type='text' name='email' value='{logged_in_email}' /></p>
<p><input type='submit' value='Flag as inappropriate' /></p>
{if can_quarantine}
<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?
{/if}
{/quarantine_form}
{if:else}
<p>{if has_flagged}
Sorry, you have already flagged this entry.
{if:else}
You don't have permission to flag this entry.
{/if}</p>
{/if}
{/exp:lg_quarantine:form}
{/exp:weblog:entries}
This tag renders the form element including the required hidden variables. It is a required tag.
There is also the option to include a reason for this flag, a comment by the user flagging the comment and their email address.
The reason form element must have its name attribute value set to "flag_type". It is recommended that you use the {flag_types} single variable combinded with a select drop down for this element. See the sample code above.
The comment form element must have its name attribute value set to "comment".
The email form elemment must have its name attribute value set to "email".
Single Variables
The following single variables are available in the {quarantine_form} tag pair:
{flag_types}
{quarantine_form}
<p>Reason: <select name='flag_type'>
<option value=''>-- Please Choose --</option>
{flag_types}
</select></p>
<p>Comment: <textarea name='comment' rows='3' cols='20'></textarea></p>
<p>Email: <input type='text' name='email' value='{logged_in_email}' /></p>
<p><input type='submit' value='Flag as inappropriate' /></p>
{if can_quarantine}
<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?
{/if}
{/quarantine_form}
The {flag_types} single varaible renders multiple <option> tags filled with the values from flag types extension setting.
Conditionals
Conditional variables allow you to control what content is displayed to the user. The following conditional variables are available:
if can_quarantine
{if can_quarantine}
<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?
{/if}
Checks if the user can automatically quarantine the entry or comment overiding the flag count. This is useful for super admins moderating comments from the front end of the site. This also requires that the user can flag the entry or comment.
if can_flag
{if can_flag}
{quarantine_form} ... {/quarantine_form}
{/if}
Can the current user flag the entry or comment? The ability to flag is determined by:
- The user is not banned
- The user is not from a banned nation
- The user has not been black listed
- The user is a member of one of the allowed flagging member groups
- The entry or comment allows duplicate flags
If all the above conditions have been met the user is allowed to throw a flag.
if has_flagged
{if has_voted}
You have already voted in the poll.
{/if}
{if has_voted and can_vote}
You have already flagged this entry however duplicate votes are allowed.
{/if}
This conditional is used to show a custom message if the user has already thrown a flag for this entry or comment.
Change Log
1.0.0
- Initial release with documentation.
License
LG Quarantine is a free commercial product and therefore its usage is subject to the commercial license agreement.
Contributors
Make a donation of $30 or more and get your website listed.
Page created on: Sep 01, 2008
Last updated on: Sep 27, 2008


Enjoy LG Quarantine v1.0.0? Bookmark and share it with others.