# Copyright 2001-2005 Six Apart. # SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS # # $Id: Comment.pm 10197 2005-03-09 00:27:57Z ezra $ package MT::Comment; use strict; use MT::Object; @MT::Comment::ISA = qw( MT::Object ); __PACKAGE__->install_properties({ columns => [ 'id', 'blog_id', 'entry_id', 'author', 'commenter_id', 'visible', 'email', 'url', 'text', 'ip', ], indexes => { ip => 1, created_on => 1, entry_id => 1, blog_id => 1, email => 1, commenter_id => 1, visible => 1, }, audit => 1, datasource => 'comment', primary_key => 'id', }); sub visible { my $this = shift; if (@_ == 1) { return $this->set_values({visible => $_[0]}); } return $this->column('visible'); } 1; __END__ =head1 NAME MT::Comment - Movable Type comment record =head1 SYNOPSIS use MT::Comment; my $comment = MT::Comment->new; $comment->blog_id($entry->blog_id); $comment->entry_id($entry->id); $comment->author('Foo'); $comment->text('This is a comment.'); $comment->save or die $comment->errstr; =head1 DESCRIPTION An I object represents a comment in the Movable Type system. It contains all of the metadata about the comment (author name, email address, homepage URL, IP address, etc.), as well as the actual body of the comment. =head1 USAGE As a subclass of I, I inherits all of the data-management and -storage methods from that class; thus you should look at the I documentation for details about creating a new object, loading an existing object, saving an object, etc. =head1 DATA ACCESS METHODS The I object holds the following pieces of data. These fields can be accessed and set using the standard data access methods described in the I documentation. =over 4 =item * id The numeric ID of the comment. =item * blog_id The numeric ID of the blog in which the comment is found. =item * entry_id The numeric ID of the entry on which the comment has been made. =item * author The name of the author of the comment. =item * commenter_id The author_id for the commenter; this will only be defined if the commenter is registered, which is only required if the blog config option allow_unreg_comments is false. =item * ip The IP address of the author of the comment. =item * email The email address of the author of the comment. =item * url The URL of the author of the comment. =item * text The body of the comment. =item * visible Returns a true value if the comment should be displayed. Comments can be hidden if comment registration is required and the commenter is pending approval. =item * created_on The timestamp denoting when the comment record was created, in the format C. Note that the timestamp has already been adjusted for the selected timezone. =item * modified_on The timestamp denoting when the comment record was last modified, in the format C. Note that the timestamp has already been adjusted for the selected timezone. =back =head1 DATA LOOKUP In addition to numeric ID lookup, you can look up or sort records by any combination of the following fields. See the I documentation in I for more information. =over 4 =item * created_on =item * entry_id =item * blog_id =back =head1 AUTHOR & COPYRIGHTS Please see the I manpage for author, copyright, and license information. =cut