Home » Documentation » What is PeoplePods? » SDK Documentation » Object Definitions » Comment Object

Comment Object

The comment object is a pretty simple object with only a few fields. Each comment is linked to a person object representing the author of the comment, and a content object representing the piece of content upon which the comment was left.


id the unique id of this comment
contentId reference to a piece of content
userId reference to the comment's author
id the unique id of this comment
comment the text of the comment
date timestamp of when the comment was posted
type short string, used to create multiple types of comment - ie review vs comment
permalink url for this comment
minutes minutes since the comment was posted


You can access the author of the comment using the $comment->author() function, which returns a person object.

// access person object member functions
echo "Comment by: ";

// output the author using a special template

You can also access the content upon which the comment was left, using the handy $comment->parent() function.

// access content values

// is this comment by the original poster?
if ($comment->get('userId')==$comment->parent()->get('userId')) { 
  // do something

Loading Comments

The vast majority of the time, you'll probably be displaying the comments that are attached to the piece of content you are viewing. To do this, simply use the $content->comments() function, which returns a list of the comments in chronological order.

You can also load a specific comment by it's id using the $POD->getComment() function.

If you need to query the comment database on any of the comment fields or fields in the related tables, use the $POD->getComments() function.

// output the comments from a piece of content

// load a specific comment (for editing, etc)
$comment = $POD->getComment(array('id'=>1));

// load all comments from a user
$comments = $POD->getComments(array('userId'=>1));

// load all comments from any piece of content in a specific group
$group_comments = $POD->getComments(array('d.groupId'=>5));

Adding and Removing Commments

The best way to add a comment is to use the $content->addComment() function, which handles all the nitty gritty details.

To delete comments, call $comment->delete().

  • Discuss This Document

No comments have been posted yet.

Download Download the latest version of PeoplePods!

0.7 Latest Version:
Release Notes

A free membership is required to download PeoplePods.

  Already Registered? Login

Recent Posts from Our Blog

Version 0.7 Now Available

Last night, I uploaded a new release of PeoplePods: version 0.7. The most exciting new features in this version are: new dynamic image resizing options, a faster comment polling system, new ways...

Developer Preview Launch!

I am very excited to announce the launch of PeoplePods version 0.666, THE DEVELOPER PREVIEW! After tons of hacking, I have tweaked the last line of code, and I am finally ready for a wider audience...