Commit 6c88cca9 authored by sampaioprimo's avatar sampaioprimo

[ADD] support for user articles and forum comments on tiki-user_information.php

parent 67b7398e
......@@ -515,6 +515,19 @@ $show_expdate, $show_reads, $show_size, $show_topline, $show_subtitle, $show_lin
return $ret;
}
function get_user_articles($user, $max) {
$query = "select `articleId` ,`title` from `tiki_articles` where `author`=? order by `publishDate` desc";
$result = $this->query($query,array($user),$max);
$ret = array();
while ($res = $result->fetchRow()) {
$ret[] = $res;
}
return $ret;
}
}
global $dbTiki;
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/lib/commentslib.php,v 1.155 2007-07-08 17:39:04 nyloth Exp $
// $Header: /cvsroot/tikiwiki/tiki/lib/commentslib.php,v 1.156 2007-07-08 22:57:22 sampaioprimo Exp $
//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
header("location: index.php");
......@@ -1176,6 +1176,19 @@ class Comments extends TikiLib {
return true;
}
function get_user_forum_comments($user, $max) {
$query = "select `threadId`, `object`, `title` from `tiki_comments` where `objectType`='forum' AND `userName`=? ORDER BY `commentDate` desc;";
$result = $this->query($query,array($user),$max);
$ret = array();
while ($res = $result->fetchRow()) {
$ret[] = $res;
}
return $ret;
}
// FORUMS END
function get_comment($id, $message_id=null) {
if ($message_id) {
......
......@@ -109,6 +109,24 @@
{/section}
</table>
{/if}
{if $user_articles|@count > 0}
<h2>{tr}Articles{/tr}</h2>
<table class="normal">
{cycle values="even,odd" print=false}
{section name=ix loop=$user_articles}
<tr><td class="{cycle}"><a class="link" title="{tr}view{/tr}" href="tiki-read_article.php?articleId={$user_articles[ix].articleId}">{$user_articles[ix].title}</a></td></tr>
{/section}
</table>
{/if}
{if $user_forum_comments|@count > 0}
<h2>{tr}Forum comments{/tr}</h2>
<table class="normal">
{cycle values="even,odd" print=false}
{section name=ix loop=$user_forum_comments}
<tr><td class="{cycle}"><a class="link" title="{tr}view{/tr}" href="tiki-view_forum_thread.php?comments_parentId={$user_forum_comments[ix].threadId}&forumId={$user_forum_comments[ix].object}">{$user_forum_comments[ix].title}</a></td></tr>
{/section}
</table>
{/if}
</td></tr>
{/if}
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-user_information.php,v 1.41 2007-05-04 14:09:48 sylvieg Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-user_information.php,v 1.42 2007-07-08 22:57:22 sampaioprimo Exp $
// Copyright (c) 2002-2007, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
......@@ -12,9 +12,16 @@ require_once ('tiki-setup.php');
include_once ('lib/messu/messulib.php');
include_once ('lib/userprefs/scrambleEmail.php');
include_once ('lib/registration/registrationlib.php');
include_once ('lib/wiki/wikilib.php');
include_once ('lib/trackers/trackerlib.php');
if ($feature_display_my_to_others == 'y') {
include_once ('lib/wiki/wikilib.php');
include_once ('lib/articles/artlib.php');
include_once ("lib/commentslib.php");
//Not sure if the line below should be here or in the lib
$commentslib = new Comments($dbTiki);
}
if (isset($_REQUEST['userId'])) {
$userwatch = $tikilib->get_user_login($_REQUEST['userId']);
if ($userwatch === NULL) {
......@@ -132,6 +139,10 @@ if ($feature_display_my_to_others == 'y') {
$smarty->assign_by_ref('user_blogs', $user_blogs);
$user_galleries = $tikilib->get_user_galleries($userwatch, -1);
$smarty->assign_by_ref('user_galleries', $user_galleries);
$user_articles = $artlib->get_user_articles($userwatch, -1);
$smarty->assign_by_ref('user_articles', $user_articles);
$user_forum_comments = $commentslib->get_user_forum_comments($userwatch, -1);
$smarty->assign_by_ref('user_forum_comments', $user_forum_comments);
}
if ( $user_tracker_infos ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment