Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

Original topic : [url="https://www.torrenttrader.org/topic/10318-last-forum-block/"]https://www.torrenttrader.org/topic/10318-last-forum-block/[/url]

I just made some changes

Requirement :

1. class color function.

Class Colors Function for 2.08 : [url="https://www.torrenttrader.org/topic/17452-class-colors-function-for-208/"]https://www.torrenttrader.org/topic/17452-class-colors-function-for-208/[/url]

You can use Attach File OR Create a file called latestforum_block.php

<?php

begin_block("Latest Forum Topics");
/// HERE GOES THE QUERY TO RETRIEVE DATA FROM THE DATABASE AND WE START LOOPING ///
$for = mysql_query("SELECT * FROM forum_topics ORDER BY lastpost DESC LIMIT 7");

while ($topicarr = mysql_fetch_assoc($for)) {
// Set minclass
$res = mysql_query("SELECT name,minclassread FROM forum_forums WHERE id=$topicarr[forumid]") or sqlerr();
$forum = mysql_fetch_assoc($res);

//if ($forum["minclassread"] > '0') {
if (($forum["minclassread"]  >= '1') && ($forum["minclassread"]  < '5')) {
$forumname = "<a href=?action=viewforum&amp;forumid=$topicarr[forumid]><b>" . htmlspecialchars($forum["name"]) . "</b></a>";

$topicid = $topicarr["id"];
$topic_title = stripslashes($topicarr["subject"]);
$topic_userid = $topicarr["userid"];

/// GETTING USERID AND DATE OF LAST POST ///  
$res = mysql_query("SELECT * FROM forum_posts WHERE topicid=$topicid ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res);
$postid = 0 + $arr["id"];
$userid = 0 + $arr["userid"];
$added = "<nobr>" . $arr["added"] . "</nobr>";

/// GETTING THE LAST INFO AND MAKE THE TABLE ROWS ///
$r = mysql_query("SELECT lastpostread FROM forum_readposts WHERE userid=$userid AND topicid=$topicid") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r);
$new = !$a || $postid > $a[0];
$char1 = 60; //cut length
$subject = "<a href=forums.php?action=viewtopic&topicid=$topicid><b>" . CutName(htmlspecialchars($topicarr["subject"]), $char1) . "</b></a>";

/// GET NAME OF THE AUTHOR ///
$res = mysql_query("SELECT id, username, class FROM users WHERE id=$topic_userid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 1) {
$arr = mysql_fetch_assoc($res);
$author = "<a href=account-details.php?id=$topic_userid>".class_user($arr[username])."</a>";
}
else
$author = "Unknown[$topic_userid]";

/// GETTING THE LAST INFO AND MAKE THE TABLE ROWS ///
$r = mysql_query("SELECT lastpostread FROM forum_readposts WHERE userid=$userid AND topicid=$topicid") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r);
$new = !$a || $postid > $a[0];
$subject = "<a href=forums.php?action=viewtopic&topicid=$topicid><b>" . stripslashes(encodehtml($topicarr["subject"])) . "</b></a>";

/// GET NAME OF LAST POSTER ///
$res = mysql_query("SELECT id, username, class FROM users WHERE id=$userid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 1) {
$arr = mysql_fetch_assoc($res);
$username = "<a href=account-details.php?id=$userid>".class_user($arr[username])."</a>";
}
else
$username = "Unknown[$topic_userid]";

echo ("<left>Author : $author<br>Subject :$subject<br>Last Replies : $replies  &nbsp;$username<br>On : $added</left><hr>");

}
}
end_block();

?>
This is working on v2.08 & Tested.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6784"]latestforum_block.php[/url]

[color=rgb(40,40,40)]Nice works[/color]
Ban comments — 2013-06-14 19:20:35 in v2.08 Mods Completed
working on 2.08

Thanks mate.
nice work
Thanks for the info  :)
Thanks
Thanks for the Info  :)
Thanks for the Info  :)
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728