Backend\Modules\Blog\Engine\Api::commentsUpdateStatus PHP Method

commentsUpdateStatus() public static method

Update the status for multiple comments at once.
public static commentsUpdateStatus ( array $id, string $status )
$id array The id/ids of the comment(s) to update.
$status string The new status for the comment. Possible values are: published, moderation, spam.
    public static function commentsUpdateStatus($id, $status)
    {
        // authorize
        if (BaseAPI::isAuthorized() && BaseAPI::isValidRequestMethod('POST')) {
            // redefine
            if (!is_array($id)) {
                $id = (array) explode(',', $id);
            }
            $status = (string) $status;
            // update statuses
            BackendBlogModel::updateCommentStatuses($id, $status);
        }
    }