Comment class

Class that contains an individual comment.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Comment class also inherits all the methods and properties of: WireData and Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
Comment::allowChildren()
bool

Are child comments (replies) allowed?

 
Comment::children()
CommentArray

Return children comments, if applicable


Can also be used as property: Comment::children
 
Comment::cleanCommentString(string $str)
string

Clean a comment string by issuing several filters

 
Comment::depth()
int

Get current comment depth


Can also be used as property: Comment::depth
 
Comment::editUrl()
string

Return URL to edit comment

 
Comment::get(string $key)
mixed

Get property

 
Comment::getField()
null Field CommentField

Get Field that this Comment belongs to

 
Comment::getFormatted(string $key)
string

Same as get() but with output formatting applied

 
Comment::getFormattedCommentText()
string

Get comment text as formatted string

 
Comment::getGravatar(string $email)
string

Returns a URL to this user's gravatar image (static version, use non-static gravatar() function unless you specifically need static)

 
Comment::getMeta()
string array int float mixed null

Get meta data property value (custom fields for comments)

 
Comment::getPage()
null Page

Get Page that this Comment belongs to

 
Comment::gravatar()
string

Returns a URL to this user's gravatar image

 
Comment::hasChild($comment)
bool

Does this comment have the given child comment?

 
Comment::httpUrl()
string

Return full http URL to view comment

 
Comment::isApproved()
None

Returns true if the comment is approved and thus appearing on the site

 
Comment::meta()
array string int mixed

Get or set meta data property

 
Comment::numChildren()
int

Return number of children (replies) for this comment


Can also be used as property: Comment::numChildren
 
Comment::parent()
Comment null

Return the parent comment, if applicable


Can also be used as property: Comment::parent
 
Comment::parents()
CommentArray

Get CommentArray of all parent comments for this one


Can also be used as property: Comment::parents
 
Comment::quiet()
bool

Get or set quiet mode

 
Comment::removeMeta(string $key)
self

Remove given meta data property or '*' to remove all

 
Comment::renderStars()
string

Render stars markup

 
Comment::set(string $key, mixed $value)
self WireData

Set property

 
Comment::setField(Field $field)
None

Set Field that this Comment belongs to

 
Comment::setMeta($key)
self

Set meta data (custom fields for comments)

 
Comment::setPage(Page $page)
None

Set Page that this Comment belongs to

 
Comment::url()
string

Return URL to view comment

 
Comment::wired()
None

Wired to API

 

Properties

NameReturnSummary 
Comment::approvalNote null string Runtime approval note for newly added comment, internal use 3.0.169 
Comment::cite string  
Comment::code string  
Comment::created int  
Comment::createdUser User User that created the comment 
Comment::created_users_id int  
Comment::downvotes int  
Comment::email string  
Comment::flags int  
Comment::id int 
Comment::ip string  
Comment::isNew null bool Was this comment added in this request? 3.0.169 
Comment::loaded bool True when comment is fully loaded from DB 3.0.149 
Comment::parent_id int  
Comment::prevStatus int null 
Comment::sort int  
Comment::stars int 
Comment::status int 
Comment::subcode string  
Comment::text string  
Comment::textFormatted string null Text value formatted for output (runtime use only, must be set manually) 
Comment::upvotes int  
Comment::user_agent string  
Comment::website string  

Additional methods and properties

In addition to the methods and properties above, Comment also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252