Comment Moderation Development
|
johndbritton
![]()
Joined: 2005-03-23
Posts: 73 |
Posted: Fri, 2007-11-30 05:23
|
|
I've just begun work on the Comment Module to add administrator approval for all comments. I'll be posting here over the coming days with questions, progress and requests for input. Stay tuned. |
|
| Login or register to post comments |


Posts: 73
First of all, now that I've got your attention from the various threads addressing this topic/feature I'd like to apologize for all the spamming. I really just wanted to bring everyone together to one thread so that we can make the best use of our time and come up with the best implementation of this feature possible.
Posts: 73
Here's a screenshot of the admin section... I've decided for now not to get too complicated, but I'd like to be able to choose by user group if the comment has to be moderated by a human.
Posts: 4
This looks real good, thanks for your efforts. It may be redundant to do so with Akismet, but would a box for banned keywords be appropriate?
Posts: 73
Development continues on IRC:
Posts: 6
Seconding this. If a comment contains an expression in the blacklist, it won't go up without approval. I would suggest adding the phrase "Link Portal" as a factory default.
Posts: 73
I'm working off svn, and ive attached a patchfile to this post up to this point. I've got a admin preference to enable disable moderation and new comments are being marked as UNPUBLISHED or PUBLISHED correctly... now I just need to build the interface to moderate the comments.
more progress:
[1:45pm] johndbritton: would i use GalleryPlugin::getParameter() ?
[1:51pm] valiantd: eiter $module->getparameter() or gallerycoreapi::getpluginparameter()
[1:51pm] valiantd: depends on whether you have loaded $module before
[1:52pm] johndbritton: ah.. im calling this from withing the Comment class
[1:52pm] johndbritton: so ill use coreapi
[1:52pm] valiantd: core api then
[1:52pm] johndbritton: the setting is called comment.moderate
[1:54pm] valiantd: comment. is kinda redundant since it's already a setting of the comment module
[1:54pm] johndbritton: i thought that was the naming convention of gallery
[1:56pm] valiantd: for permissions, yes
[1:56pm] dzosh joined the chat room.
[1:56pm] talmdal joined the chat room.
[1:56pm] talmdal was granted voice by ChanServ.
[1:57pm] johndbritton: http://pastebin.com/d578ad0c4
[1:58pm] johndbritton: i copied it from the comments.latest checkbox
[1:58pm] valiantd: for plugin params you dont need to prefix params with the module id, unless it makes sense (i.e. it makes thing clearer)
[1:59pm] johndbritton: oh, ok
[1:59pm] valiantd: now your mixing .tpl with plugin params. it's good if theyre following the same conventions, but its not the same
[1:59pm] valiantd: i guess youre right, its more consistent
[2:00pm] johndbritton: whats the difference?
[2:00pm] valiantd: keep your prefix
[2:00pm] johndbritton: ok
[2:00pm] valiantd: its not the same in all modules
[2:00pm] johndbritton: hmm, what i did was i copied the show latest comments option in my implementation
[2:02pm] valiantd: k, should be a good base for a new option
[2:02pm] johndbritton: the API docs say that getPluginParameter returns an array... do you know where the docs are for the format of that array
[2:03pm] valiantd: modules7core/classes/gallerycoreapi.class
[2:03pm] valiantd: the api docs should be more specifc though
[2:04pm] valiantd: dont they say that the array consists of a gallerystatus, value?
[2:04pm] valiantd: its the same pattern almost everywhere
[2:04pm] johndbritton: getPluginParameter [line 302]
[2:04pm] johndbritton: array getPluginParameter( string $pluginType, string $pluginId, string $parameterName, [string $itemId = 0] )
[2:04pm] johndbritton: Convenience method to retrieve a plugin parameter
[2:04pm] johndbritton: Parameters:
[2:04pm] johndbritton: string $pluginType:
[2:04pm] johndbritton: string $pluginId:
[2:04pm] johndbritton: string $parameterName:
[2:04pm] johndbritton: string $itemId: (optional)
[2:04pm] johndbritton: API Tags:
[2:04pm] johndbritton: Return: GalleryStatus a status code string a value
[2:04pm] talmdal: mindless: are u waiting for me to do anything more in review 440 (i've added some unit tests)?
[2:04pm] valiantd: first element = success or not, other elements = returned data
[2:04pm] mindless: talmdal: nope
[2:05pm] mindless: haven't looked
[2:05pm] talmdal: k, just checking
[2:05pm] talmdal: consider yourself pinged
[2:06pm] johndbritton: so gallery status is just a code followed by elements that are the return of the function, so if i test the second element (Index 1) thats where my bool would be?
[2:06pm] valiantd: please take a look at existing g2 code
[2:06pm] valiantd: it's always the same pattern
[2:06pm] johndbritton: ok
[2:07pm] valiantd: list ($ret, $data) = functioncall();
[2:07pm] valiantd: if ($ret) { handle error }
[2:07pm] talmdal: johndbritton: consider the gallery status ($ret) an exception condition, since we can't throw exceptions in php 4.x
[2:08pm] valiantd: which has been discussed / explained maybe 3 times in the last 1-2 weeks
[2:08pm] valiantd: so its in the channel logs
[2:08pm] talmdal:
[2:08pm] johndbritton: ok, well now its 4... lol
[2:09pm] talmdal: at this rate, we should setup a channel command ~explain_ret
[2:11pm] valiantd: or dump the idea of 2.3 and switch to exceptions right away
[2:11pm] valiantd: jk
[2:11pm] talmdal: +1
[2:12pm] talmdal: cya later...
[2:12pm] johndbritton: http://pastebin.com/d79a9431
[2:12pm] johndbritton: thats what ive come up with... looking into error handling now
[2:16pm] valiantd: dont forget the error checking
[2:16pm] valiantd: see the if ($ret) stuff above your new section
[2:16pm] valiantd: you need to do that too
[2:16pm] johndbritton: ok...
[2:17pm] johndbritton: http://pastebin.com/d49716a09
[2:17pm] valiantd: @style: we give vars a specific name. e.g. $moderate instead of $data
[2:17pm] johndbritton: like that... what exactly happens there?
[2:17pm] johndbritton: will chagne
[2:18pm] valiantd: do you know the concept of exceptions in java?
[2:18pm] johndbritton: yss
[2:18pm] valiantd: it's an imitation. php4 doesnt support exceptions
[2:19pm] johndbritton: oh, ok
[2:19pm] valiantd: so we have to return a success value for each function call
[2:19pm] johndbritton: should i be putting my logic in an else off that exception check
[2:19pm] valiantd: on error, return the error to the calling function
[2:19pm] valiantd: no
[2:19pm] valiantd: it's fine like that
[2:19pm] johndbritton: great
[2:20pm] johndbritton: off to the database to see if it works!
[2:20pm] valiantd: did you already insert the new plugin parameter?
[2:20pm] valiantd: ::setpluginparameter
[2:21pm] johndbritton: in the install section of module.inc i added some stuff
[2:21pm] valiantd: or in module.inc function upgrade(), do $this->setparameter
[2:21pm] valiantd: ok
[2:21pm] johndbritton: i re ran the gallery install and it showed up in the DB
[2:21pm] johndbritton: and it persists the state, so i think its working
[2:22pm] valiantd: k
[2:23pm] grund left the chat room. (Read error: 104 (Connection reset by peer))
[2:23pm] johndbritton: it works!
[2:24pm] johndbritton: it is set to published / unpublished correctly
[2:24pm] valiantd:
[2:25pm] johndbritton: so i think what im going to do is modify the Moderate Spam admin section
[2:25pm] johndbritton: to make it just a moderate area
[2:25pm] johndbritton: where you can moderate Akismet spam and "unpublished" comments
Posts: 6
Forgive me for being so inquisitive, but is there an automated method for applying the patch, or do I have to look into it and do it all myself?
Posts: 73
AXYPB: I don't know how you would apply the patch... I've never done it, check google. I bet this will be in SVN soon though, so you could just wait.
I've been making excellent progress, I've got the basic functionality working... I've attached another patch with the most recent modifications. Again this patch is from SVN revision 17213.
More IRC progress:
Posts: 73
Screenshots:
Comment Moderation Queue

Comment Settings

Image with Comment

Posts: 6
I'll just wait then. These features look great and I am eager to apply them when they're released in SVN.
Posts: 73
Has anyone had a chance to review the code I've posted? I'm looking for any feedback from gallery devs.
Thanks!
Posts: 31959
see: development -> code reviews.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 73
I tried creating an account... but I don't have a password... do I have to wait for approval or something?
Posts: 31959
it's explained at development -> code reviews. after registering you account at reviews.gallery2.org, you should be able to sign in with a blank password field (or use the one you used when registerung your account, if possible).
this worked a month ago.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 73
I tried doing that, but it wasn't working. I talked to someone on IRC and they created the account for me... I think it was mindless, but im not sure. Regardless, I've got an account and I'll post for review soon.
Posts: 8
Any updates on this?
Posts: 31959
johndbritton never opened a code review...
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 73
Sorry for the delay, I've uploaded a patch file of the working code to this thread, but haven't opened a code review because I've been unable to get the appropriate Java installed on the dev system. I've not abandoned work though, I still need this feature and would like it integrated with gallery2. I'm moving the code to a machine that I have root access on and will try to get the code review stuff installed.
Posts: 48
sorry for my ignorance. But where can i download the latest patch file on this thread?
regards,
--reynan
Posts: 73
Code has been posted for review in Code Collab: http://reviews.gallery2.org/index.jsp?page=ReviewDisplay&reviewid=561
We should have this done soon!
Posts: 48
wow.. good.
I just applied the patch to the svn file for comments and it works great.
hmmnn.. Just wondering... can I apply the patch to the current release version 2.2.4?
or can you make a patch to the current release of gallery? As I really want to apply it now on my current version.
regards,
--reynan
Posts: 73
I've submitted the code for review... All I have left is to write some unit tests, hopefully the code will be in SVN this week sometime. We'll see. I'm making a patch against the latest revision for you now.
John
Posts: 73
few minor changes... latest patch against SVN r17475, hopefully my next release will be in SVN.
Posts: 48
thanks.
anyway.. just a question? Is it possible to patch the current release of gallery2. (gallery 2.2.4)?
Posts: 73
I almost always run G2 from SVN, so I don't have a patch to the release. I'm not sure of the changes since the realase and the current SVN revision. You could try to run that patch against the gallery release, but BACK UP FIRST. I don't know if it will work or not.
Posts: 73
Unit tests are completed and this feature is now available in SVN and nightly builds dated Feb 22 2008 and later. This feature will be available in the Gallery v2.3 release.
Posts: 47
Excellent! However, this will not let us handle existing comments in a batch?
Posts: 73
I don't quite understand what you mean by "handle existing comments in a batch"
Posts: 47
Sorry, by that I mean that many of us have tons of spam comments on our sites, because it's difficult to keep up with the incoming spam comments.
Therefore it would be nice to have a possibility to delete these comments in one go, instead of having to delete them one by one.
I currently don't show comments on my sites because of this.
Posts: 31959
@jhave:
g2.3's (= current nightly snapshot) comment module has akismet spam detection and comment moderation.
and it has a "delete all spam" button in site admin.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 40
With more then two pages of comments in the queue I have to exit the moderation then reenter to approve the remaining comments. Not a big deal of course. Bumping to say thanks this feature is essential
Posts: 47
@valiant thanks! I'll try it out!