Hi,
I’ve been running tt-rss on my home server for a long time now. It works great and I love it, so I hadn’t felt the need to update for some time (cough 3 years cough).
Anyway, I git pull origin-ed yesterday and everything’s great.
Everything but my “custom” reddit comment count display. At some point, I think reddit stopped updating their feeds with number of comments a post had. At that time, I created a service (php file) that updated the ttrss_entries table with number of comments a post had via reddit’s api. I can no longer see this number
I have been looking at the code since, and, being a mediocre programmer, I am kind of confused. From what I can tell ttrss_entries.num_comments is no longer used to fill-in what is displayed as number of comments for an entry. (I am having a hard time figuring out how “headlines” ultimately get populated from backend to js).
I think I can hook into things and replicate my previous behavior (see example below).
Is HOOK_FORMAT_ARTICLE the right one to use for updating number of comments that are displayed? In experimenting with it, I can’t get HOOK_FORMAT_ARTICLE to do anything. I don’t think it’s triggering at all? I tried deleting my session from ttrss_sessions to see if that would trigger it, but it seems not.
Thanks in advance!
<?php
class Reddit_Comments extends Plugin {
private $host;
// You can change the description of this plugin here
function about() {
return array(1.0,
"Update reddit comments count via their api.",
"d0e8414e");
}
function api_version() {
return 2;
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
$host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
}
function hook_article_filter($article) {
//Call reddit api to update comment count in
//ttrss_entries?
return $article;
}
function hook_render_article($article) {
//Run sql query and change article content div to show
//comment number from ttrss_entries??
return $article;
}
}
?>