Hi Andy,
pretty quiet in here ;-)
So what about a global to get the latest bbpress plugin threads?
This code below calls the latest wordpress entries. Perhabs there is not much to change for bbpress?
my $prefix = 'wp_';
use DBI;
my $dbh = DBI->connect('DBI:mysql:xxxxxxxxxxxxxxxxxxxxxxxx
) || die "Could not connect to database: $DBI::errstr";
my $query = qq|SELECT * FROM ${prefix}posts WHERE post_parent < 1 AND post_status = 'publish' AND post_type = "post" ORDER BY ID DESC LIMIT 3|;
my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
$sth->finish();
$dbh->disconnect();
return { blog_loop => \@loop }
}
Thanks
Matthias
gpaed.de
pretty quiet in here ;-)
So what about a global to get the latest bbpress plugin threads?
This code below calls the latest wordpress entries. Perhabs there is not much to change for bbpress?
Code:
sub { my $prefix = 'wp_';
use DBI;
my $dbh = DBI->connect('DBI:mysql:xxxxxxxxxxxxxxxxxxxxxxxx
) || die "Could not connect to database: $DBI::errstr";
my $query = qq|SELECT * FROM ${prefix}posts WHERE post_parent < 1 AND post_status = 'publish' AND post_type = "post" ORDER BY ID DESC LIMIT 3|;
my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
$sth->finish();
$dbh->disconnect();
return { blog_loop => \@loop }
}
Thanks
Matthias
gpaed.de