summaryrefslogtreecommitdiff
path: root/modules/tracker/tracker.module
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-05-12 19:31:50 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-05-12 19:31:50 +0000
commitea4643a180680ccb480e96472d47bc39d0a39a11 (patch)
treec6c1a9c1402b15d540d46950e03b6e968bcfb1eb /modules/tracker/tracker.module
parentcb2345e9c3c31efca0dea4299fff544581bf90fd (diff)
downloadbrdo-ea4643a180680ccb480e96472d47bc39d0a39a11.tar.gz
brdo-ea4643a180680ccb480e96472d47bc39d0a39a11.tar.bz2
- fixed links.
- added link to a users recent comments on their info page.
Diffstat (limited to 'modules/tracker/tracker.module')
-rw-r--r--modules/tracker/tracker.module50
1 files changed, 33 insertions, 17 deletions
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 7f415e2dd..2b3b1ecbd 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -8,7 +8,7 @@ function tracker_help() {
function tracker_link($type) {
- if ($type == "menu.view") {
+ if ($type == "menu.view" && user_access("access comments")) {
$links[] = lm(t("view new comments"), array("mod" => "tracker"), "", array("title" => t("Display an overview of the recent comments.")));
}
@@ -16,8 +16,6 @@ function tracker_link($type) {
}
function tracker_comments($id = 0) {
- global $theme, $user;
-
$period = time() - 259200; // all comments of the past 3 days
if ($id) {
@@ -39,7 +37,7 @@ function tracker_comments($id = 0) {
$output .= "<ul>";
while ($comment = db_fetch_object($cresult)) {
- $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), $comment->cid) ." by ". lm(check_output($comment->name), array("mod" => "user", "op" => "view", "id" => $comment->uid)) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
+ $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." by ". lm(check_output($comment->name), array("mod" => "user", "op" => "view", "id" => $comment->uid)) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
}
$output .= " </ul>\n";
}
@@ -58,20 +56,38 @@ function tracker_menu() {
function tracker_page() {
- global $theme, $id;
-
- $theme->header();
-
- $theme->box(t("Tracker"), tracker_menu());
-
- if ($id) {
- $theme->box(t("Your recent comments"), tracker_comments($id));
- }
- else {
- $theme->box(t("All recent comments"), tracker_comments());
+ global $theme, $id, $user;
+
+ if (user_access("access comments")) {
+ if ($id == $user->uid) {
+ $theme->header(t("Your recent comments"));
+ $theme->box(t("Tracker"), tracker_menu());
+ $theme->box(t("Your recent comments"), tracker_comments($id));
+ $theme->footer();
+ }
+ else if ($id) {
+ $account = user_load(array("uid" => $id));
+ $theme->header(t("%u's recent comments", array("%u" => $account->name)));
+ $theme->box(t("Tracker"), tracker_menu());
+ $theme->box(t("%u's recent comments", array("%u" => $account->name)), tracker_comments($id));
+ $theme->footer();
+ }
+ else {
+ $theme->header(t("All recent comments"));
+ $theme->box(t("Tracker"), tracker_menu());
+ $theme->box(t("All recent comments"), tracker_comments());
+ $theme->footer();
+ }
}
-
- $theme->footer();
}
+function tracker_user($type, &$edit, &$user) {
+ switch ($type) {
+ case "view_public":
+ case "view_private":
+ if (user_access("access comments")) {
+ return form_item(t("Comments"), lm(t("View recent comments."), array("mod" => "tracker", "id" => $user->uid)));
+ }
+ }
+}
?>