Update 1.0.0:
Version 1.0.0 is now available!
Heres the link: LG Quarantine - Flag ExpressionEngine entries and comments as inappropriate.
Hey guys,
I have just built a new module that needs some rigorous testing.
It’s called LG Quarantine and it allows users to flag weblog entries and comments. After a designated number of flags have been thrown the entry/comment is quarantined and a couple of things happen.
So hows it work…
Each entry/comment has a simple form added to it that stores some secure params and settings. When the form is submitted a new flag is added to the DB… other magic happens… I have chosen to use a form for a couple of reasons but the number one is security and it removes the risk of search engines accidently flagging all your entries as they index your site.
The module also features a couple of report pages listing flagged entries, flagged comments and individual flags so you can keep track of whats happening on your site.
The extension settings (there is an extension as part of the module) allows you to restrict who can flag and auto quarantine entries/comments. It also allows you to set the email responses, ajax server responses (if the form is submitted via ajax) and a couple of other things.
Implementing the {exp:lg_quaranine:form} tag inside of a weblog entries tag
Like I said either entries and/or comments can be flagged. This is great for user generated SAEF entries.
Example code (should be pretty self explanitory):
{exp:weblog:entries status='open|closed' limit="1"}
{title}
{exp:lg_quarantine:form
{!-- Required --}
entry_type = 'entry'
entry_id = '{entry_id}'
{!-- Optional --}
notify_admins = 'y'
notify_author = 'y'
notify_admin_emails = 'test@leevigraham, [email protected]'
return = '{comment_entry_id_auto_path}'
return_if_quarantined = '{path="quarantine/success"}'
quarantine_status = 'closed'
form_name = 'form name'
form_id = 'form id'
form_class = 'form class'
}
{if can_flag}
{quarantine_form}
<input type='submit' value='Flag as inappropriate' />
{if can_quarantine}<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?{/if}
{/quarantine_form}
{if:else}
{if has_flagged}
Sorry, you have already flagged this entry.
{if:else}
You don not have permission to flag this entry.
{/if}
{/if}
{/exp:lg_quarantine:form}
<hr >
{/exp:weblog:entries}
Implementing the {exp:lg_quaranine:form} tag inside of a comments tag
Eactly the same:
{exp:comment:entries sort="asc" limit="20"}
{comment}
By {name} on {comment_date format="%Y %m %d"}
{exp:lg_quarantine:form
{!-- Required --}
entry_type = 'comment'
entry_id = '{comment_id}'
{!-- Optional --}
notify_admins = 'y'
notify_author = 'y'
notify_admin_emails = 'test@leevigraham, [email protected]'
return = 'template_group/template'
return_if_quarantined = '{path="quarantine/success"}'
quarantine_status = 'closed'
form_name = 'form name'
form_id = 'form id'
form_class = 'form class'
}
{if can_flag}
{quarantine_form}
<input type='submit' value='Flag as inappropriate' />
{if can_quarantine}<input type='checkbox' name='auto_quarantine' value='y' /> Auto Quarantine?{/if}
{/quarantine_form}
{if:else}
{if has_flagged}
Sorry, you have already flagged this entry.
{if:else}
You don not have permission to flag this entry.
{/if}
{/if}
{/exp:lg_quarantine:form}
<hr >
{/exp:comment:entries}
{exp:lg_quaranine:form} Settings
Most of the settings are pretty self explanitory but I’ll go over a couple of the important ones here:
entry_type: Must be either set to ‘entry’ or ‘comment’
entry_id: Must be either set to the entry_id or comment_id
return: The return path if an entry is flagged
return_if_quarantined: If an entry is quarantined it is likey its status will have changed so you might want to redirect to an index page or something similar.
quarantine_status: If an entry is quarantined its status can be set to something other than default set in the extension settings.
Instalation
The module comes with a module folder, extension file and a couple of language files.
Install the module and activate the extension and you should be good to go.
Wrap Up
I have tested this module pretty heavily and haven’t found any significant bugs. That said there are probably still improvements to be made so I’m throwing it out there for testing.
Another important disclaimer. I will probably end up developing this as a commercial module so if you plan to use this in your site feel free to download it but you will need to purchase a license in the future. If thats a worry best not to download it. 😊
Other than that enjoy.
Leevi
Oh yeah… you can grab it form here: removed (see update)
Just uploaded some screenshots here, here & here
Update: I have been using this module quite a bit lately and I believe its ready for primetime.
The docs are currently being prepared before release but if you would like a copy email me and I’ll send you the license details.
Thanks for supporting independent EE development!
Lots of potential here. I uploaded the module to two EE installs. One is on Engine hosting and the other is at https://signup.dreamhost.com/ (dreamhost). On the dreamhost EE dev test install I get this error when clicking the “install” link in the module CP page (I checked that all files have been uploaded):
Parse error: syntax error, unexpected ‘(‘, expecting ‘}’ in /pathtowebsitedomain/system/modules/lg_quarantine/mcp.lg_quarantine.php on line 181
–
So, I set up on the Engine hosted EE install to double check and it installed fine there. However, in the extension, when
Can site visitors flag an entry / comment more than once?
is set to “no” it always displays:
You don not have permission to flag this comment. Sorry, you have already flagged this comment.
When I change that setting to “Yes” then it will allow Flagging but it will also still display:
Sorry, you have already flagged this comment.
After that, I made sure that i was not checking IP or cookie and just checking by user ID and same results. I logged in using a different user ID and received same results as before.
Other than that, it does as expected with quarantining flagged entries and showing results in the module page. Pretty darn cool if I could just get it to play nice in the template.
If you want to access either install and take a look, just let me know and I’ll set up access for you.
Thanks, Rob.
This looks almost perfect for a site update that I’m in the middle of. Any chance you could add another field in the table for users which explains why the entry/comment should be guaranteed? For example, Digg allows users to flag content as stuff like Lame, Duplicate Story, Spam, and a few other things.
Hey man. Everything looks good to me. Only thing is, only because it’s coming up blank, I assume we have to create a /quarantine/success page? What do you suggest it entail?
Also, if we make the form button an input image, will it still work? I know IE has some issues with image submit buttons. Still need to check.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.