Versatile
Joined: 11 Aug 2003 Posts: 3
|
Posted: Mon Aug 11, 2003 4:44 am Post subject: who posted comments |
|
|
Hya,
I couldn't find a hack who provided wich user(s) has posted comments ..
Maybe it's already here ..and maybe i didn't read the complete manual but here it is
ps: i've got the latest version (maybe it's of interest )
in b2template.functions.php scoll to the bottom of the page and paste te following:
function who_posted_comments($delimiter=","){
global $id;
$sql = "select count(cm.comment_author) as number,cm.comment_author as com from b2comments as cm,b2posts as po where cm.comment_post_ID = po.ID and po.ID= " . $id . " group by cm.comment_author";
$query = @mysql_query($sql);
if (($query) && (mysql_num_rows($query))) {
while($whoposted = mysql_fetch_object($query)){
$whopostedall .= strip_tags(stripslashes($whoposted->com)) . "(" . $whoposted->number . ")" . $delimiter ;
}
$lendelim = strlen($delimiter);
$whopostedall = substr($whopostedall,0,-$lendelim);
echo $whopostedall;
}
}
that's all
now you can call the function on the "main page" with <? who_posted_comments(); ?>
Parameter is optional
If you fill something in ..do it like <? who_posted_comments("-"); ?>
The php strips away the " and so the - becomes the delimiter between the names
If you don;t fill anything in ...the comma is used.
Example
<A HREF="<?php comments_link("") ?>" title="<? who_posted_comments(); ?>"><?php comments_number("no comments","1 comment","% comments") ?>
have fun _________________ "Unix IS user friendly
- it's just selective about who its friends are. " |
|