Use this plugin to display the last comments posted by each user.
| General Plugin info | |
|---|---|
| Author: | Ricardo Lamego, PiyoPiyoNaku |
| Current Version: | 0.2 |
| Download: | here |
| Code: | plugin_code (outdated v0.1) |
| Demo: | - |
| Forum Thread: | - |
Use <%MemberComments%> in the member skin. It will show the default number of comments in all blogs.
Other options:
(Outdated v0.1) Just copy and save the following code as NP_MemberComments.php:
<? /** * This plugin can be used to display the last few user comments. */ class NP_MemberComments extends NucleusPlugin { function getEventList() { return array(); } function getName() { return 'Member Comments'; } function getAuthor() { return 'Ricardo Lamego'; } function getURL() { return 'http://35mm.org/'; } function getVersion() { return '0.1'; } function getDescription() { return 'Use this plugin to display the last comments posted by each user. <%MemberComments%> will show the default number of comments in <strong>all</strong> blogs. <%MemberComments(5)%> overrides the default number of comments and will display only 5. <%MemberComments(5,3)%> will do as stated before plus will only show comments from blogid 3.'; } function install() { $this->createOption('option1','Max number of comments?','text','10'); $this->createOption('option2','Max number of characters in each comment:','text','85'); $this->createOption('option3','Break comments by words instead of by characters?','yesno','yes'); } // skinvar plugin can have a blogname as second parameter function doSkinVar($skinType) { global $manager, $blog, $CONF,$memberid; $params = func_get_args(); $option1 = $this->getOption('option1'); $option2 = $this->getOption('option2'); $option3 = $this->getOption('option3'); if ($option1) { $numberOfComments = $option1; } else { $numberOfComments = 10; } if ($option2) { $numberOfCharacters = $option2; } else { $numberOfCharacters = 85; } // how many comments will be shown? if ($params[1]) { $numberOfComments = $params[1]; } // show comments from all blogs if (!$params[2]) { $blogid = "";} // show comments from the actual blog else if ($params[2] == "0") { $blogid = " AND cblog=".$blog->getID(); } // show comments from the default blog else if ($params[2] == "default") { $blogid = " AND cblog=".$CONF['DefaultBlog']; } // show comments from the selected blog id else { $blogid = " AND cblog=".$params[2]; } $query = "SELECT cuser, cbody, citem, cmember, ctime FROM nucleus_comment WHERE cmember=". $memberid ."".$blogid." ORDER by ctime DESC LIMIT 0,".$numberOfComments; $comments = mysql_query($query); while($row = mysql_fetch_object($comments)) { $text = $row->cbody; $text = strip_tags($text); $time = $row->ctime; $ctime = ereg_replace("^(.{1,10})[ :,].*", "\\1", $time); // break comments by words if ($option3 == "yes") { $ctext = ereg_replace("^(.{1,$numberOfCharacters})[ .,].*", "\\1", $text); } // break comments by characters else { $ctext = substr($text, 0, $numberOfCharacters); } if (!$row->cmember) $myname = $row->cuser; else { $mem = new MEMBER; $mem->readFromID(intval($row->cmember)); // show short member names if ($option1 == "yes") { $myname = $mem->getDisplayName(); } // show real member names else { $myname = $mem->getRealName(); } } $itemlink = createItemLink($row->citem, ''); echo " <p><a href=\"".$IndexURL.$itemlink."\">". $ctime .":</a> "; echo $ctext; echo "...<p>"; } } } ?>