Hello,

I want to display in a block the total number of (active) users and (published) nodes. I searched around the module directory but did not found such a module..

Kind regards,
nocte

Comments

semperos’s picture

You could write the following to get that info from the database and return the results with some meaningful text around it:

<?php

$active_users = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE status=1"));
$num_of_nodes = db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE status=1"));

$output = "The total number of active users on this site is: " . $active_users . "<br/>";
$output .= "The total number of published pages on this site is: " . $num_of_nodes;

return $output

?>
vm’s picture

http://drupal.org/project/hof may also be worth looking at