I am using it inside include/user/blogmenu.php and it doesn't work. Here is the script.
<?php
/*********************************************************************
start output of the left block
*********************************************************************/
require PUN_ROOT.'lang/'.$pun_user['language'].'/blog.php';
if ($bid > 0 || $cid > 0 || $cat_id > 0 || $pop > 0 || $lat > 0 || $comm > 0)
{
?>
<?php
}
?>
<div class="block">
<h2 class="block2"><span><?php echo $lang_blog['Blogs menu'] ?></span></h2>
<div class="box">
<div class="inbox"><dl>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php"><?php echo $lang_blog['User blogs'] ?></a></dd>
<?php
if (!$pun_user['is_guest'])
{
?>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php?bid=<?php echo $pun_user['id'] ?>"><?php echo $lang_blog['View mine'] ?></a></dd>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php?uid=<?php echo $pun_user['id'] ?>"><?php echo $lang_blog['Create'] ?></a></dd>
<?php
}
if ($pun_user['is_guest'])
{
$result = $db->query('SELECT cat_id FROM '.$db->prefix.'blog_perms WHERE post_cat=1 AND group_id=3') or error('Unable to fetch blog info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
?>
<dd><a href="blogs.php?uid=<?php echo $pun_user['id'] ?>">Create New Blog</a></dd>
<?php
}
}
?>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php?lat=1"><?php echo $lang_blog['Latest'] ?></a></dd>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php?pop=1"><?php echo $lang_blog['Most viewed'] ?></a></dd>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="blogs.php?comm=1">Most Commented</a></dd>
<dd><img style="vertical-align: middle;" src="img/blog_icon_dot.gif" alt="" /> <a href="userlist.php?bloggers"><?php echo $lang_blog['Blogger list'] ?></a></dd>
</dl><hr />
<dl>
<dt><span class="blogcats"><?php echo $lang_blog['Categories'] ?></span></dt>
<?php
$result = $db->query('SELECT c.* FROM '.$db->prefix.'blog_categories AS c LEFT JOIN '.$db->prefix.'blog_perms AS p ON (p.cat_id=c.id AND p.group_id='.$pun_user['g_id'].') WHERE p.read_cat IS NULL OR p.read_cat=1 ORDER BY c.num_blogs DESC') or error('Unable to fetch blog info', __FILE__, __LINE__, $db->error());
while ($cat = $db->fetch_assoc($result))
{
?>
<dd><img style="vertical-align: middle;" src="img/blog_icon_redarrow.gif" alt="" /> <a href="blogs.php?cat_id=<?php echo $cat['id'] ?>"><?php echo pun_htmlspecialchars($cat['categories']) ?> - <?php echo $cat['num_blogs'] ?></a></dd>
<?php
}
?>
</dl><hr />
<dl>
<dt><span class="bloglatest"><?php echo $lang_blog['Latest'] ?></span></dt>
<?php
//$result = $db->query('SELECT * FROM '.$db->prefix.'blogs ORDER BY id DESC LIMIT 0 , 10') or error('Unable to fetch blog info', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT b.* FROM '.$db->prefix.'blogs AS b LEFT JOIN '.$db->prefix.'blog_perms AS p ON (p.cat_id=b.cat_id AND p.group_id='.$pun_user['g_id'].') WHERE p.read_cat IS NULL OR p.read_cat=1 ORDER BY b.id DESC LIMIT 0 , 10') or error('Unable to fetch blog info', __FILE__, __LINE__, $db->error());
while ($cur_blog = $db->fetch_assoc($result))
{
?>
<dd><img style="vertical-align: middle;" src="img/blog_icon_bluearrow.gif" alt="" /> <a href="blogs.php?cid=<?php echo $cur_blog['id'] ?>&c_id=<?php echo $cur_blog['id'] ?>" title="<?php echo $cur_blog['heading'] ?>"><?php echo substr($cur_blog['heading'],0 ,15) ?>...</a></dd>
<?php
}
?>
</dl><hr />
<dl>
<dt><span class="bloglatest_bloggers"><?php echo $lang_blog['Latest bloggers'] ?></span></dt>
<?php
$result = $db->query('SELECT DISTINCT poster, poster_id FROM '.$db->prefix.'blogs') or error('Unable to fetch blog info', __FILE__, __LINE__, $db->error());
while ($blogger = $db->fetch_assoc($result))
{
?>
<dd><img style="vertical-align: middle;" src="img/blog_icon_greenarrow.gif" alt="" /> <a href="blogs.php?bid=<?php echo $blogger['poster_id'] ?>"><?php echo pun_htmlspecialchars($blogger['poster']) ?></a></dd>
<?php
}
?> </dl>
</div>
</div>
</div>