I'm trying to get Pagehits 1.0-beta2 working on modx revolution 2.2.10
Snippet displays results in manager only if I manually add my prefix before site_content table in code below (pagehits.class.php). Otherwise I get error
public function prepareQueryBeforeCount(xPDOQuery $c) {
$c->select(array('id', '(SELECT pagetitle FROM ' . $modx->db->config['table_prefix'] . 'my-prefix_site_content WHERE id = resource_id) AS pagetitle', 'COUNT(resource_id) AS hits', 'resource_id')) ;
$c->groupBy('resource_id');
$c->prepare() ;
return $c;
}
Error log:
Array
(
[0] => 42000
[1] => 1146
[2] => Table 'p465428228.site_content' doesn't exist
)
Can anybody help to change code to get table_prefix automaticly?