function _comment_resource_delete in Services 6.3
Same name and namespace in other branches
- 7.3 resources/comment_resource.inc \_comment_resource_delete()
Delete a comment.
Parameters
$cid: Unique identifier of the comment to delete.
Return value
True.
1 string reference to '_comment_resource_delete'
- _comment_resource_definition in resources/
comment_resource.inc - @file Will define the comments resource for dealing with node comments
File
- resources/
comment_resource.inc, line 326 - Will define the comments resource for dealing with node comments
Code
function _comment_resource_delete($cid) {
// Load in the required includes for comment_delete.
module_load_include('inc', 'comment', 'comment.admin');
// The following is from comment_confirm_delete_submit in comment.admin.inc
$comment = _comment_load($cid);
if (empty($comment)) {
return services_error(t('There is no comment found with id @cid', array(
'@cid' => $cid,
)), 404);
}
// Delete comment and its replies.
_comment_delete_thread($comment);
_comment_update_node_statistics($comment->nid);
// Clear the cache so an anonymous user sees that his comment was deleted.
cache_clear_all();
return TRUE;
}