I'd like to have a page listing the names of my entries and how many times each has been hit. I use the Karma plugin now and it functions perfectly but I would like to be able to compare hit counts per entry at a glance, don't want to call up each entry to see how many hits.
I'm not a PHP programmer but maybe with some direction I can write a PHP script which creates a web page to do this. From reading here in the forum I think I would have to access the Karma hit variable for each entry along with the entry ID numbers. My script would have to convert the ID back to entry title then list it with the hit count next to it. I would want to format this in two neat columns.
I've been looking at the PHP of the Karma Plugin but I don't see where it gets the entry ID or how to access the table that stores the hit counts for the entries.
Suggestions? Direction? Thanks. If I get it working I will of course share it with all interested.
The best,
~Ed587
Questions about the Karma plugin
Re: Questions about the Karma plugin
The best,
~Ed
~Ed
Re: Questions about the Karma plugin
The horror... the horror...
That plugin is a snarl of half-understood code and translation errors. I should know; I refactored it and added image rating bars and an editable log. Don and I banged on it for weeks before we were happy with it. And I still don't understand it all.
The hit count is called "visits", and it's stored in the karma database table. To access it, you'd want code like:
There's already a hook in the plugin to do this, called "event_additional_statistics". It gets called when you install the serendipity_event_statistics plugin. (That plugin's displayed name changes with your language; in English, it's "Statistics".)
Let us know if there's any other way we can assist you with this.
That plugin is a snarl of half-understood code and translation errors. I should know; I refactored it and added image rating bars and an editable log. Don and I banged on it for weeks before we were happy with it. And I still don't understand it all.
The hit count is called "visits", and it's stored in the karma database table. To access it, you'd want code like:
Code: Select all
$q = "SELECT e.id,
e.title,
e.timestamp,
SUM(k.visits) AS total
FROM {$serendipity['dbPrefix']}karma
AS k
JOIN {$serendipity['dbPrefix']}entries
AS e
ON k.entryid = e.id
WHERE k.visits IS NOT NULL AND k.visits != 0
GROUP BY e.id, e.title, e.timestamp ORDER BY total DESC LIMIT {$addData['maxitems']}";
$sql_rows = serendipity_db_query($q);
Let us know if there's any other way we can assist you with this.
Re: Questions about the Karma plugin
Thanks for the reply Judebert. Hey, looking over the Statistics Plugin I see what I wanted is already in there. If anything, I might work on getting it to show me the number of hits of all entries.
~Ed587
~Ed587
The best,
~Ed
~Ed