From 14ce7b4d4ebaf1091083d46b86d3a17964b8c8a1 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 17 Aug 2009 13:10:45 +0000 Subject: #545956 by claudiu.cristea: Add a presave hook to comments. --- modules/comment/comment.api.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'modules/comment/comment.api.php') diff --git a/modules/comment/comment.api.php b/modules/comment/comment.api.php index acd23bfc3..d7a1ef2c7 100644 --- a/modules/comment/comment.api.php +++ b/modules/comment/comment.api.php @@ -11,6 +11,19 @@ * @{ */ +/** + * The comment passed validation and is about to be saved. + * + * Modules may make changes to the comment before it is saved to the database. + * + * @param $comment + * The comment object. + */ +function hook_comment_presave($comment) { + // Remove leading & trailing spaces from the comment subject. + $comment->subject = trim($comment->subject); +} + /** * The comment is being inserted. * -- cgit v1.2.3