www/adiumxtras.com 46:a1ed8316ad19: Show the 5 latest comments f...

commits at adium.im commits at adium.im
Fri Feb 20 23:10:02 UTC 2015


details:	http://hg.adium.im/www/adiumxtras.com/rev/a1ed8316ad19
revision:	46:a1ed8316ad19
branch:		adiumxtras.com
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Sat Feb 21 00:09:55 2015 +0100

Show the 5 latest comments for each user on their profile.

diffs (30 lines):

diff -r 58327051c635 -r a1ed8316ad19 templates/profile.tpl
--- a/templates/profile.tpl	Fri Feb 20 23:49:00 2015 +0100
+++ b/templates/profile.tpl	Sat Feb 21 00:09:55 2015 +0100
@@ -51,4 +51,10 @@
 	</tr>
 </table>
 
+<h3>Latest comments</h3>
+
+{foreach name=comments item=comment from=$comments}
+	{include file="comment.tpl" comment=$comment}
+{foreachelse}
+
 {include file="footer.tpl"}
\ No newline at end of file
diff -r 58327051c635 -r a1ed8316ad19 users.php
--- a/users.php	Fri Feb 20 23:49:00 2015 +0100
+++ b/users.php	Sat Feb 21 00:09:55 2015 +0100
@@ -356,6 +356,11 @@
 			$smarty->assign("burninate", (currentUID() && array_search(userLevel(currentUID()), array("Admin", "Developer", "Moderator")) !== TRUE));
 			$smarty->assign("accounts", $accounts);
 			$smarty->assign("user", $user);
+			$sql->query("SELECT * FROM comments WHERE user_id='%d' ORDER BY posted LIMIT 5 DESC", intval($_GET['user_id']));
+			while ($comment = $sql->fetch_assoc()) {
+				$comments[] = $comment;
+			}
+			$smarty->assign("comments", $comments);
 			$smarty->display("profile.tpl");
 		break;
 	}




More information about the commits mailing list