Node statistics and views

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'nodereference_autocomplete_access' was given in /home/mnnnecdq/public_html/drupalme/includes/menu.inc on line 452.
Wednesday, November 4, 2009 - 14:12

Have you seen the frontpage of virb.com? they have a stats-list on the page. My project is an "ad-site", free to use here in norway. If you want to create something similar to the stas-list on virb.com this is how you can do it. This tutorial is about how you can count nodes published within a certain catergory.

1. This is the stats-list on virb.com, pretty nice. If you know css it's very easy to theme drupal views.
2. Create a new view and give it a unique name.
3. You need to provide an argument. Node:type
4. Give the argument these settings.
5. An unformatted list is a good choice.
6. Select which fields that shall be displayed.
7. Filter should be Nod:type and select the content type you are using.
8. Display only one item in the list. It will just repeat itself if you select a double-digit.
9. Hit preview to see the results. You might want to create a block-display for this view and clone it to create the same function for another content type.

Comments

Nice one

Cool looking tutorial. Thanks for sharing.

How do I get user stats to show

Thanks for the great tutorial. I managed to get stats to be displayed for a node but how do I get USER stats to show. I picked active user for field and filter.
Also how do you get the stat count not to link back to the node? Thanks

It depends on how you choose to show the statistics.

I found it easier to use this code http://drupalme.no/content/count-nodes-content-types and place it in a block. If you want to count registered users you can use this code:


<?php
$r=db_query("SELECT COUNT(uid) AS num_users
FROM {users} WHERE status=1;");
$n=db_fetch_array($r);
print "There are {$n['num_users']} users.";
?>

Add comment

The content of this field is kept private and will not be shown publicly.