marking articles as read through plugin

Post plugins and custom CSS snippets here
davide_c
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 28 Mar 2013, 14:15

marking articles as read through plugin

Postby davide_c » 28 Jun 2013, 13:25

Hello

I was wondering if there is a way to mark an article as read, based on content, through a plugin.

something along the lines of:

Code: Select all

<?php
class Af_test extends Plugin {
    private $host;

    function about() {
        return array(1.1,
            'test',
            'test',
            false,
            "");
    }

    function init($host) {
        // Boilerplate to register hooks.
        $this->host = $host;

        $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
    }

   function api_version() {
      return 2;
   }

    function hook_article_filter($article) {
                $doc = new DOMDocument();
                @$doc->loadHTML($article['content']);

                if ($condition) {
                        //MARK THIS AS READ
                 }


        }
        return $article;

}
?>



My use case would be, on a 9gag feed, get rid of all of the post which include animated gifs.
Or I could made two feeds, with two opposite filters, so I could have one feed with only regular images, and another one with just animated gifs, just in case I'd ever feel like browsing that.

regards

davide

User avatar
sleeper_service
Bear Rating Overlord
Bear Rating Overlord
Posts: 884
Joined: 30 Mar 2013, 23:50
Location: Dallas, Texas

Re: marking articles as read through plugin

Postby sleeper_service » 28 Jun 2013, 13:41

if there's something in the posts you can filter on, with the built in filters, that might be easier.

I do love the ability to filter posts, got a bunch of "if x in title, delete' filters .... muhahahaha

davide_c
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 28 Mar 2013, 14:15

Re: marking articles as read through plugin

Postby davide_c » 28 Jun 2013, 14:03

right... somehow I didn't think about using the default filters!!
I think a simple regexp agaiunst /gif/ should suffice, I'll try it right away

thanks


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 4 guests