[support] Automatically Approve Comment For Return Visitors
Jamie Holly
hovercrafter at earthlink.net
Mon Nov 23 17:34:17 UTC 2009
I'm not sure if there is a module for this, but it would be really
simple to do in a small module:
function mymodule_comment(&$comment, $op) {
if ($op=='insert' && !$comment['uid']){ //only perform on operating
insert for new comments and if the user is anonymous
$has_published=db_result(db_query("SELECT cid FROM {comments}
WHERE status=%d AND mail='%s', COMMENT_NOT_PUBLISHED, $comment['mail']);
// query database for a previously approved comment by this email
if (!$has_published){
db_query("UPDATE {comments} SET status=%d WHERE
cid=%d",COMMENT_NOT_PUBLISHED,$comment['cid']); //set the current
comment to unpublished
$comment['status']=COMMENT_NOT_PUBLISHED; //return with a
status of not published so the user is notified that their comment is
awaiting approval
}
}
}
I would suggest adding an index on mail in the comments table (even
better - status,mail).
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
Steve Kessler wrote:
>
> Dear Drupal Community,
>
>
>
>
>
> I have a project that wants to be able to have return visitors put
> their email into comments and be authenticated for comment approval.
> The client does not want the user to need to create an account but if
> an account was created for the person in the Drupal system this would
> not be a problem.
>
>
>
> Evidently this is done with Wordpress and I am hoping someone can
> recommend a module or recipe for making this happen with Drupal.
>
>
>
> Thanks,
>
> Steve
>
>
>
> Steve Kessler
>
> *Denver DataMan *
>
> 303-587-4428
>
> Sign up for the Denver DataMan Free eNewsletter
> <http://www.denverdataman.com/content/enewsletter-signup>
>
>
>
More information about the support
mailing list