DavidLara
09-28-2004, 02:11 PM
ATTN: Administration Elite,
I would like to ask you something about the Latest Threads block. Maybe I have not understood your idea clearly, but for me it seems confusing, some posts are duplicated loosing some space for other posts to be seen. :roll:
Maybe you did it that way in order to make us browse thru the actual forum index and not the latest threads block, if that's the idea it's ok.
But, hey I was used to the old JO Latest Threads block when they had the PHPNuke running.
Ok if my opinion is shared, I modified the code myself, since PHP Nuke 7.2 has a weird Latest Thread Block as well by default (it only shows your topic title, not the latest poster, the number of posts, views etc.)
Ok the following code will show the latest n number of posts, lead by the topic title, latest poster and number of posts so far (just simple, as you can notice anything could be added, but it looks simple IMO).
<code start>
if (eregi("block-Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $db, $sitename;
$result = $db->sql_query("SELECT forum_id, topic_id, topic_title, topic_replies FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT 10");
$content = "
";
while ($row = $db->sql_fetchrow($result)) {
$forum_id = intval($row['forum_id']);
$topic_id = intval($row['topic_id']);
$result2 = $db->sql_query("SELECT poster_id FROM ".$prefix."_bbposts WHERE (forum_id = '$forum_id' AND topic_id = '$topic_id')");
while ($row3 = $db->sql_fetchrow($result2)) {
$poster_id = intval($row3['poster_id']);}
$result3 = $db->sql_query("SELECT username FROM ".$prefix."_users WHERE user_id = '$poster_id'");
$fetch = mysql_fetch_object($result3);
$nombre = $fetch->username;
$topic_replies = intval($row['topic_replies']);
$topic_title = $row['topic_title'];
$row2 = $db->sql_fetchrow($db->sql_query("SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id='$forum_id'"));
$auth_view = intval($row2['auth_view']);
$auth_read = intval($row2['auth_read']);
if (($auth_view < 2) OR ($auth_read < 2))
{
$content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\"><a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id \">$topic_title</a>
";
$content .= "<font size=\"1\">Replies::</font> $topic_replies
";
$content .= "<font size=\"1\">Last reply by:</font> $nombre
";
}
}
$content .= "
<center><a href=\"modules.php?name=Forums\">$sitename Forums</a>
</center>";
<code end>
Maybe I am wrong because I have not got your idea, but it's just an idea, my 0.2 cents (CHF) 8)
I would like to ask you something about the Latest Threads block. Maybe I have not understood your idea clearly, but for me it seems confusing, some posts are duplicated loosing some space for other posts to be seen. :roll:
Maybe you did it that way in order to make us browse thru the actual forum index and not the latest threads block, if that's the idea it's ok.
But, hey I was used to the old JO Latest Threads block when they had the PHPNuke running.
Ok if my opinion is shared, I modified the code myself, since PHP Nuke 7.2 has a weird Latest Thread Block as well by default (it only shows your topic title, not the latest poster, the number of posts, views etc.)
Ok the following code will show the latest n number of posts, lead by the topic title, latest poster and number of posts so far (just simple, as you can notice anything could be added, but it looks simple IMO).
<code start>
if (eregi("block-Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $db, $sitename;
$result = $db->sql_query("SELECT forum_id, topic_id, topic_title, topic_replies FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT 10");
$content = "
";
while ($row = $db->sql_fetchrow($result)) {
$forum_id = intval($row['forum_id']);
$topic_id = intval($row['topic_id']);
$result2 = $db->sql_query("SELECT poster_id FROM ".$prefix."_bbposts WHERE (forum_id = '$forum_id' AND topic_id = '$topic_id')");
while ($row3 = $db->sql_fetchrow($result2)) {
$poster_id = intval($row3['poster_id']);}
$result3 = $db->sql_query("SELECT username FROM ".$prefix."_users WHERE user_id = '$poster_id'");
$fetch = mysql_fetch_object($result3);
$nombre = $fetch->username;
$topic_replies = intval($row['topic_replies']);
$topic_title = $row['topic_title'];
$row2 = $db->sql_fetchrow($db->sql_query("SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id='$forum_id'"));
$auth_view = intval($row2['auth_view']);
$auth_read = intval($row2['auth_read']);
if (($auth_view < 2) OR ($auth_read < 2))
{
$content .= "<img src=\"images/arrow.gif\" border=\"0\" alt=\"\" title=\"\" width=\"9\" height=\"9\"><a href=\"modules.php?name=Forums&file=viewtopic&t=$topic_id \">$topic_title</a>
";
$content .= "<font size=\"1\">Replies::</font> $topic_replies
";
$content .= "<font size=\"1\">Last reply by:</font> $nombre
";
}
}
$content .= "
<center><a href=\"modules.php?name=Forums\">$sitename Forums</a>
</center>";
<code end>
Maybe I am wrong because I have not got your idea, but it's just an idea, my 0.2 cents (CHF) 8)