I have a requirement where I want to show the total number of hits that a user's items have been read. For example, if they have ten K2 items, each have been read 10 times, then I want to show the total number (in this case 100) of hits that users total items have been read.
K2 has a variable, which I can echo for each of the items:
<?php echo $item->hits; ?>
But I need a way to add all of the authors items hits up.
** Update **
So I'm thinking, could this be done using a SQL query? Something similar to:
SELECT count('hits') FROM #__k2_items WHERE authorid='id';
sum('hits')
. check with this if it works – Liz. Oct 19 '16 at 13:28