Count register user, topics & post on the forum
Last modified: August 8, 2008 - 14:29
<?php
$count[users] = db_result(db_query("SELECT COUNT(*) FROM {users}"));
$count[topics] = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = 'forum'"));
$count[comments] = db_result(db_query("SELECT COUNT(*) FROM {node n}, {comments c} WHERE n.type = 'forum' AND n.nid = c.nid"));
$output = "<p>";
$output .= t("%count_users online user, %forum_topics topics and %forum_comments posts on the forum", array('%count_users' => $count[users], '%forum_topics' => $count[topics], '%forum_comments' => $count[comments]));
$output .= "</p>";
return $output;
?>This snippets return some think like this:
1455 register user, 689 topics and 988 post on the forum
