3

I'm using Drupal 7. After enabling the Statistics module, I see, under each node, how many times it has been read (e.g. "4 reads"). How can I remove this expression while I'm using it ("Content statistics: Total views") in my views?

5

According the code of the statistics module, you can just remove the "view post access counter" permission from all roles.

| improve this answer | |
  • Does not seem to work for administrator role. – sasdev Dec 4 '13 at 8:25
  • Yes, sure. Administrators have all rights, always. – BetaRide Dec 4 '13 at 9:13
8

I needed a simple page counter but did not want to see the "reads" on every node page even as the site admin. For my drupal 7 "fusion" sub theme I used this in my template.php

function yourfusionsubthemename_preprocess_node(&$vars) {


unset($vars['content']['links']['statistics']['#links']['statistics_counter']['title']);



}
| improve this answer | |
  • that was awesome! – Mohsen Sep 27 '16 at 7:36
1

If the permissions don't work, you can also unset it in your THEME_preprocess_node() function (in your template.php). Just add the following line:

  unset($content['links']['statistics']['#links']['statistics_counter']['title']);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.