boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

who posted comments

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Versatile



Joined: 11 Aug 2003
Posts: 3

PostPosted: Mon Aug 11, 2003 4:44 am    Post subject: who posted comments Reply with quote

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 Very Happy

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. "
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rmaathuis



Joined: 05 Jan 2004
Posts: 7
Location: The Netherlands

PostPosted: Tue Jul 06, 2004 3:27 pm    Post subject: Reply with quote

Thank you for this great hack. This is exactly what I wanted, and it works Smile see my site.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group