Hello
I want to know how can I show number of posts & threads of a forum everywhere I want ?
I want to know how can I show number of posts & threads of a forum everywhere I want ?

// Fetch replies and count them
$timesearchposts = 143; // This is forum FID value
$query = $db->query("
SELECT p.pid, p.fid, COUNT(*) AS poststoday
FROM ".TABLE_PREFIX."posts p
WHERE p.fid = $timesearchposts
");
while ($posts = $db->fetch_array($query)) {
echo("<div>Posts in the forum <strong>fid{$timesearchposts}</strong> - {$posts['poststoday']}</div><br/>");
}
// Fetch threads and count them
$timesearchthreads = 143; // This is forum FID value
$query2 = $db->query("
SELECT t.tid, t.fid, COUNT(*) AS poststoday
FROM ".TABLE_PREFIX."threads t
WHERE t.fid = $timesearchthreads
");
while ($threads = $db->fetch_array($query2)) {
echo("<div>Threads in the forum <strong>fid{$timesearchthreads}</strong> - {$threads['poststoday']}</div><br/>");
}
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("index_start", "poststhreadscount");
function poststhreadscount_info()
{
return array(
"name" => "Posts Threads Counter",
"description" => "Polls the number of posts and threads from the forum of your choice ",
"website" => "http://letsforum.com/Thread-how-to-show-number-of-threads-post-of-a-forum",
"author" => "Victor Dub",
"authorsite" => "http://letsforum.com",
"version" => "1",
"compatibility" => "16*"
);
}
function poststhreadscount()
{
global $mybb, $poststhreadscounter, $db;
// Fetch replies and count them
$timesearchposts = 143; // This is forum FID value
$query = $db->query("
SELECT p.pid, p.fid, COUNT(*) AS poststoday
FROM ".TABLE_PREFIX."posts p
WHERE p.fid = $timesearchposts
");
while ($posts = $db->fetch_array($query)) {
$postscounter = "<span>Posts in the forum <strong>fid{$timesearchposts}</strong> - {$posts['poststoday']}</span>";
}
// Fetch threads and count them
$timesearchthreads = 143; // This is forum FID value
$query2 = $db->query("
SELECT t.tid, t.fid, COUNT(*) AS poststoday
FROM ".TABLE_PREFIX."threads t
WHERE t.fid = $timesearchthreads
");
while ($threads = $db->fetch_array($query2)) {
$threadscounter = "<span>Threads in the forum <strong>fid{$timesearchthreads}</strong> - {$threads['poststoday']}</span>";
}
$poststhreadscounter = "<div>{$postscounter}, {$threadscounter}</div>";
}
?>