hook_comment_presave

Versions
7
hook_comment_presave($comment)

The comment passed validation and is about to be saved.

Modules may make changes to the comment before it is saved to the database.

Parameters

$comment The comment object.

Related topics

Code

modules/comment/comment.api.php, line 21

<?php
function hook_comment_presave($comment) {
  // Remove leading & trailing spaces from the comment subject.
  $comment->subject = trim($comment->subject);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.