XF 2.0 Can't access number of resource watchers

entelechy

Active member
I'm trying to access and display the number of watchers on each resource. The test resource I'm using has 3 users watching it, but when I call SELECT * FROM `xf_rm_resource_watch`; in mysql it comes back with an empty set.

Also have tried adding Callback.php to the resource manager addon directory with:


<?php
namespace lgxExtendXFRM;
class Callback
{
public static function getString($contents, $params)
{
$watch = \XF::db()->fetchOne(" SELECT count(*)
as count FROM xf_rm_resource_w$
return $watch;
}
}

And calling this in the template for the resource page I'm testing on:

<li>Watchers:&nbsp;&nbsp; <xf:callback class="lgxExtendXFRM\\Callback" method="getString" params="[ $resource->resource_id ]"></xf:callback> </li>

Does anyone know why this would be failing to display "3" but instead displaying "0" for "Watchers"?
 
Top Bottom