Reputation: 480
In an ezpublish extension i need to know when a new comment is created and to get all informations about it.
I have seen in a blog that an object can be get with this:
$currentNode = eZContentObjectTreeNode::fetch($nodeId);
but my question is, a comment is a ezContentObject?
And is it possible to delete a comment?
Thanks :-)
Upvotes: 0
Views: 384
Reputation: 916
If your comments are handled as content objects (basically if you don't use eZ Comments), then the latest comment might be retrieved in PHP using the same syntax that you usually use in templates (http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/tree), for instance :
$params = array( 'ClassFilterType' => 'include',
'ClassFilterArray' => array( 'comment' ),
'SortBy' => array( 'published', true ),
'Offset' => 0,
'Limit' => 1 );
$lastComment = eZContentObjectTreeNode::subTreeByNodeID( $params, 2 );
Note that you might need to change the class identifier to something different than comment (which is the default one when installing eZ Webin or eZ Flow) and the parent node_id from where you'll browse your content subtree (which in my example is 2.
Then if you want to remove that content, you can take a piece of code in one of these module/views :
Take care when removing a content object from your content repository, there are several operations to complete :
Hope this helps
Upvotes: 1
Reputation: 1401
This really depends on which extension you are using to handle your comments. Generic eZ Publish comments are handled as content. However, the new eZ Comments extension does not treat comments as content and are handled differently. To access eZ Comments you will have to take a look at the eZ Comments classes and module directories. That said, eZ Comments comes prepackaged with template handling, so you should be able to do everything you need to do at the template level.
Upvotes: 0
Reputation: 253
There are several ways of building forums withe eZ Publish, and the answer to your question depends on which one you chose.
Let me fire a couple of questions, that should help us help you :
Cheers,
Upvotes: 1