Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Newest Threads Forum Seclection

Quote Reply
Newest Threads Forum Seclection
Can someone please help how I can use this script below, to show latest threads from a particular forum.
What I mean is, lets say your forums are named:
1.Automotive 2.Computers 3.General, and you only want to show threads of forum 2(Computers and all it's sub's).

# get the details of the recents posts from the database
my $db = new GT::SQL $path . '/defs';
my $post_db = $db->table ('Post');
$post_db->select_options('ORDER BY post_time DESC', "LIMIT $num");
my $sth = $post_db->select;
my @output;
my $date = date_get();
while (my $post = $sth->fetchrow_hashref) {
$$post{'time_ago'} = time_ago($$post{'post_time'});
$$post{'post_time'} = date_get($$post{'post_time'});
push @output, $post;
Quote Reply
Re: [goman] Newest Threads Forum Seclection In reply to
I was helped by Alex; for those who want to know here's the code.

my $sth = $post_db->select;


my $sth = $post_db->select( { forum_id_fk => 1 });