diff --git a/account.php b/account.php index e05772c0f057ed703abc440cd3eac41f26769f26..af220522014d645aad9204b6f4ba1b4723217e43 100644 --- a/account.php +++ b/account.php @@ -201,17 +201,52 @@ function account_user($uname) { $theme->footer(); } elseif ($uname && $account = account_get_user($uname)) { + $theme->header(); + + // Display account information: $output .= "\n"; $output .= " \n"; - $output .= " \n"; + $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= "
". t("Username") .":". check_output($account->userid) ."
". t("Real name") .":". check_output($user->name) ."
". t("Real name") .":". check_output($account->name) ."
". t("E-mail") .":". format_email($account->fake_email) ."
". t("Homepage") .":". format_url($account->url) ."
". t("Bio") .":". check_output($account->bio) ."
\n"; - // Display account information: - $theme->header(); $theme->box(strtr(t("%a's user information"), array("%a" => $uname)), $output); + + // Display contributions: + if (user_access("access contents")) { + $result = db_query("SELECT n.nid, n.type, n.title, n.timestamp, COUNT(c.cid) AS count FROM node n LEFT JOIN comments c ON c.lid = n.nid WHERE n.status = '". node_status("posted") ."' AND n.author = '$account->id' GROUP BY n.nid DESC ORDER BY n.nid DESC LIMIT 25"); + + while ($node = db_fetch_object($result)) { + $nodes .= "\n"; + $nodes .= " \n"; + $nodes .= " \n"; + $nodes .= " \n"; + $nodes .= "
". t("Subject") .":nid\">". check_output($node->title) ." (". format_plural($node->count, "comment", "comments") .")
". t("Type") .":". check_output($node->type) ."
". t("Date") .":". format_date($node->timestamp) ."
\n"; + $nodes .= "

\n"; + } + + $theme->box(strtr(t("%a's contributions"), array("%a" => $uname)), ($nodes ? $nodes : t("Not posted any nodes."))); + } + + if (user_access("access comments")) { + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '$account->id' GROUP BY n.nid DESC ORDER BY n.nid DESC LIMIT 5"); + + while ($node = db_fetch_object($sresult)) { + $comments .= "

  • ". format_plural($node->count, "comment", "comments") ." ". t("attached to node") ." `nid\">". check_output($node->title) ."`:
  • \n"; + $comments .= " \n"; + } + + $theme->box(strtr(t("%a's comments"), array("%a" => $uname)), ($comments ? $comments : t("Not posted any comments."))); + } + $theme->footer(); } else { diff --git a/includes/comment.inc b/includes/comment.inc index b88ceadfc5ec1de043aea7ece2d6f42bbe1d2a32..870d5feb81ddb53ecb5773e8664f3c5a64e09ba2 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -163,20 +163,6 @@ function comment_moderation($comment) { return $output; } -function comment_controls($threshold = 1, $mode = 3, $order = 1) { - global $REQUEST_URI, $user; - $output .= "
    \n"; - $output .= "
    \n"; - $output .= comment_mode(($user->id ? $user->mode : $mode)); - $output .= comment_order(($user->id ? $user->sort : $order)); - $output .= comment_threshold(($user->id ? $user->threshold : $threshold)); - $output .= "\n"; - $output .= "\n"; - $output .= "
    \n"; - $output .= "
    \n"; - return $output; -} - function comment_threshold($threshold) { for ($i = -1; $i < 6; $i++) $options .= " "; return "\n"; @@ -273,7 +259,7 @@ function comment_render($lid, $cid) { if ($user->id) { // Comment control: - $theme->box(t("Comment control"), comment_controls($threshold, $mode, $order)); + $theme->box(t("Comment control"), $theme->comment_controls($threshold, $mode, $order)); // Print moderation form: print "
    \n";