Hi. I am trying to make a list of latest comments with Jot. I’ve modified assets/snippets/jot/jot.class.inc.php like this
this:
$this->config["docid"] = !is_null($this->Get("docid")) ? intval($this->Get("docid")):$modx->documentIdentifier;
was replaced with:
if (!is_null($this->Get("docid")) && ($this->Get("docid") == '*'))
$this->config["docid"] = '*';
else
$this->config["docid"] = !is_null($this->Get("docid")) ? intval($this->Get("docid")):$modx->documentIdentifier;
in assets/snippets/jot/includes/jot.db.class.inc.php
this:
$sql = 'SELECT count(id) FROM '.$this->tbl["content"].' WHERE uparent = '.$docid.' AND tagid = "' . $tagid .'"'.$where;
was replaced with:
if ($docid == '*')
$sql = 'SELECT count(id) FROM '.$this->tbl["content"].' WHERE tagid = "' . $tagid .'"'.$where;
else
$sql = 'SELECT count(id) FROM '.$this->tbl["content"].' WHERE uparent = '.$docid.' AND tagid = "' . $tagid .'"'.$where;
this:
switch ($viewtype) {
case 2:
$where = " and published >= 0 "; // Mixed
break;
case 0:
$where = " and published >= 0 "; // Unpublished
break;
case 1:
default:
$where = " and published = 1 "; // Published
}
was replaced with:
switch ($viewtype) {
case 2:
$where = " and a.published >= 0 "; // Mixed
break;
case 0:
$where = " and a.published >= 0 "; // Unpublished
break;
case 1:
default:
$where = " and a.published = 1 "; // Published
}
this:
$sql = "select a.* from " . $tbl . " as a " . $tblcustom . " where uparent = '" . $docid . "' and tagid = '" . $tagid ."' and mode = '0' " . $where . $orderby . $limit;
was replaced with:
if ($docid == '*')
$sql = "select a.*, b.published AS docpublished from " . $tbl . " as a " . $tblcustom . "
left join modx_site_content AS b ON a.uparent = b.id
where tagid = '" . $tagid ."' and mode = '0' and b.published='1' " . $where . $orderby . $limit;
else
$sql = "select a.* from " . $tbl . " as a " . $tblcustom . " where uparent = '$docid' and tagid = '" . $tagid ."' and mode = '0' " . $where . $orderby . $limit;
Snippet’s call:
[[Jot? &placeholders=`1` &output=`0` &tplComments=`latest_tpl` &sortby=`createdon:d` &pagination=`3` &css=`0` &docid=`*` ]]
<h2>New comment:</h2>
And this call shows all latest comments, except comments from maxigalley (pages generated by maxigallery have adress like this:
http://www.parnasmoto.ru/gallery/photo/enduro25092010?pic=6526)