Loading...
 
Skip to main content

Features / Usability


You are viewing a reply to Article Read count not working .... Update

Re: Article Read count not working .... Update

OK so i've tested it and this code works. Here is my revised function in /tiki/lib/articles/artlib.php for anyone that wants to use it although really the source should be corrected to insert an initial value into tiki_articles.nbreads

              

function add_article_hit($articleId)
        {
                global $prefs, $user;

                if ($prefs'count_admin_pvs' == 'y' || $user != 'admin') {
                $query = "update `tiki_articles` set `nbreads` = if(`nbreads` is null,1,`nbreads`+1) where `articleId`=?";

                        $result = $this->query($query, array($articleId));
                }

                return true;
        }