Jump to content

pmarki

Members
  • Posts

    26
  • Joined

  • Last visited

Recent Profile Visitors

1,282 profile views

pmarki's Achievements

Jr. Member

Jr. Member (3/6)

37

Reputation

  1. Thanks @Macrura but @flydev PM'd me first. Nothing personal, I took timestamp as main criteria. I'm glad other people find this module useful.
  2. Hi, sorry for not being up to date, I'm working with Magento now. @msncom I don't think it's possible. I am happy to pass ownership of this module to someone who will be able to maintain it. In community we trust
  3. PW refreshes versions once a day, so you have to wait or update manually.
  4. If only I knew how to do this... Adding file fields isn't easy, beacuse you have to store a file somewhere. So far I haven't find a way to achieve this But any advice would be appreciated
  5. To be honest I had the same issue and decided to count visits on other pages but home, because I was more interested in how many people visit a new post in a week than how many visits I have so far. In this case I didn't use visit_counter_flag at all assuming that visitors don't come back to posts. So in this line: if($session->get('visit_counter_flag') === 0 && !$user->isSuperuser())... I only check if not superuser, that's why there was an error with ===, sorry about that. As it was sad here: processwire.com/talk/topic/12191-make-visit-counter-code-count-once-per-session/ there are better ways for statistics, our way is suitable for estimates only. If you would like to count visits per page and on a home page you can increase siteviews if it's not a home page and event if visit_counter_flag is not 0.
  6. Sometimes most obvious things aren't obvious, so remember to check if it's working as a quest. if($session->get('visit_counter_flag') === 0 && !$user->isSuperuser())... If you are a superuser it does nothing.
  7. Yes, it works with pw3. Just updated module info and added textarea field.
  8. I have it in a site/ready.php (if you don't have this file just create one) function bot_detected() { if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) { return TRUE; } else { return FALSE; } } if($session->get('visit_counter_flag') === 0 && !$user->isSuperuser()) { if (bot_detected()) return; /* if the user is NOT logged in and not counted */ /* turn of output formating so PW do not give an error when we change the value */ $page->of(false); /* save the visitor_counter field */ $page->set('visitCounter', ($page->visitCounter ?? 0) + 1); $page->save('visitCounter', array('quiet' => true, 'uncacheAll' => false, 'resetTrackChanges' => false)); /* turn on output formating so PW work as it should */ $page->of(true); /* set a visit counter flag to 1 so next load do not count */ $session->set('visit_counter_flag', 1); } As a extra bonus this script exludes bots from statistics.
  9. I thought about it as well. If you created a foot template and a foot.php file is included in a _main.php it does't mean that fields from this template will be accessible. You should add visit_counter to page-currently-being-rendered template. Btw.: I use something like this for the same purpose: $page->save('visitCounter', array('quiet' => true, 'uncacheAll' => false, 'resetTrackChanges' => false)); Otherwise on all pages the modified user will be quest.
  10. Done, but honestly I thought it's done automatically.
  11. Oh, Forgot to change version number, but already fixed. Thanks @tpr
  12. I think I'll leave it as is. It's a good indicator for newcomers and obvious for advanced. Thanks, fixed
  13. I have reorganize module settings, it uses JSON and ASM Select for fields, now it's possible to reorder settings, add, delete and so on. The only drawback is that it's not compatible with previous version. If you want to update, you will lose all entered settings.
×
×
  • Create New...