From ea4643a180680ccb480e96472d47bc39d0a39a11 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Sun, 12 May 2002 19:31:50 +0000 Subject: - fixed links. - added link to a users recent comments on their info page. --- modules/tracker.module | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'modules/tracker.module') diff --git a/modules/tracker.module b/modules/tracker.module index 7f415e2dd..2b3b1ecbd 100644 --- a/modules/tracker.module +++ b/modules/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 .= "\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))); + } + } +} ?> -- cgit v1.2.3