/** * Set the author of the object * * @param CommentAuthor $author The author object * * @since 2.0 */ public function bindAuthor(CommentAuthor $author) { $this->author = $author->name; $this->email = $author->email; $this->url = $author->url; // set params if (!$author->isGuest()) { $this->user_id = $author->user_id; $this->user_type = $author->getUserType(); } }
public function getApprovedCommentCount(CommentAuthor $author) { // set query options if ($author && !$author->isGuest()) { $conditions = array("state = ? AND user_id = '?' AND user_type = '?'", Comment::STATE_APPROVED, $author->user_id, $author->getUserType()); } else { $conditions = array("state = ? AND user_id = '0' AND author = '?' AND email = '?'", Comment::STATE_APPROVED, $author->name, $author->email); } return $this->count(compact('conditions')); }