recent comments with mod que support
Here's an adaptation of the box above that checks for have_perm('moderate'). If a user is logged in, it shows comments in the queue. If not, it only shows ones in stories on the front page or in a section.
Code:
my $content;
my $where;
# print comments for stories in the queue
# only if the user has moderate permission
if ($S->have_perm('moderate')) {
$where = 'users.uid = comments.uid AND stories.sid=comments.sid';
}
else {
$where = 'users.uid = comments.uid AND stories.sid=comments.sid AND stories.displaystatus >
-1';
}
# get the comments and their stories/authors
my ($rv, $sth) = $S->db_select({
WHAT => 'comments.sid, comments.cid, comments.pid, comments.subject, users.nickname,
stories.title, stories.displaystatus',
FROM => 'users, comments, stories',
WHERE => $where,
ORDER_BY => 'date desc',
LIMIT => '10'});
$content .= qq{<table border="0" cellpadding="0" cellspacing="0">};
# print the stories
while (my $user = $sth->fetchrow_hashref()) {
$content .= qq{
<tr><td valign="top" align="left"> |pil| </td>
<td valign="top" align="left">|smallfont||dot| <a
href="|rootdir|/comments/$user->{sid}/$user->{cid}#$user->{cid}">$user->{subject}</a>
<font size=-1>by $user->{nickname}</font>
<font size=-2>$user->{title}
};
# print the "(queued)" for stories in the queue
if ($user->{displaystatus} <0) {
$content .= qq{(<em>queued</em>)};
}
$content .= qq{</font>
|smallfont_end|
</td>
</tr>
};
} # end while
$content .= qq{</table>};
return {content => $content};
Eric
ideas are masturbation get out get out get out