Live Plugin bug solution

(alexander) #1

Hi folks!

I’ve worked out a solution that the live plugin shows the correct number of visits and actions in the today’s view.

Due to I have no idea how to use SVN, sorry :frowning: , I’ll provide the solution on my webpage. Hope this is ok?!


(Matthieu Aubry) #2

Please take a look at the process to submit patches:…wtosubmitapatch


(alexander) #3

Hi Matt,

thanks for the link! I’ll try to stick to the guidelines…

(tyron) #4

In fact, I believe the problem is in function loadLastVisitorInLastXTimeFromDatabase, in file plugins/Live/API.php. If you look at its source, you’ll see that the parameter $days, which is passed to the function, is never used. Unfortunately, I didn’t managed to solve it, yet…

(tyron) #5

Although I believe the subject in my previous post should be investigated, I changed the function ajaxTotalVisitors in plugins/Live/Controller.php to this (note the line with $view->visitors):

public function ajaxTotalVisitors($fetch = false)
        $view = Piwik_View::factory('totalVisits');
        $view->idSite = Piwik_Common::getRequestVar('idSite');
        $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30);
        $view->visitorsCountToday = $this->getUsersInLastXDays(1);
        $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30);
        $view->pisToday = $this->getPageImpressionsInLastXDays(1);
        $view->visitors = $this->getLastVisitsStart($fetch);

        $rendered = $view->render($fetch);

            return $rendered;
        echo $rendered;