<?php
if (empty($user)) {
$user = $modx->user->get('id');
}
if ($user == 0){
return false;
}
$q = $modx->newQuery('TicketStar', array('class' => 'Ticket', 'createdby' => $user));
$q->select('id');
if ($q->prepare() && $q->stmt->execute()) {
$count = $q->stmt->fetchAll(PDO::FETCH_COLUMN);
}
echo count($count);