From d988dae61fdbbcf4802f7de1bbfa8fe4be85827a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 30 Jan 2002 18:15:02 +0000 Subject: - Applied Natrak's module improvements. --- modules/blog.module | 9 ++++++--- modules/blog/blog.module | 9 ++++++--- modules/queue.module | 2 +- modules/tracker.module | 2 +- modules/tracker/tracker.module | 2 +- modules/user.module | 26 +++++++++++--------------- modules/user/user.module | 26 +++++++++++--------------- 7 files changed, 37 insertions(+), 39 deletions(-) (limited to 'modules') diff --git a/modules/blog.module b/modules/blog.module index 04dcea472..1674394a1 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -314,9 +314,12 @@ function blog_link($type, $node = 0) { $links[] = "". t("user blogs") .""; } - if ($type == "menu") { - $links[] = "". t("add blog entry") .""; - $links[] = "uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view your blog") .""; + if ($type == "menu.create" && user_access("post content")) { + $links[] = "". t("create blog entry") .""; + } + + if ($type == "menu.view" && user_access("access content")) { + $links[] = "uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view personal blog") .""; } if ($type == "node" && $node->type == "blog") { diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 04dcea472..1674394a1 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -314,9 +314,12 @@ function blog_link($type, $node = 0) { $links[] = "". t("user blogs") .""; } - if ($type == "menu") { - $links[] = "". t("add blog entry") .""; - $links[] = "uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view your blog") .""; + if ($type == "menu.create" && user_access("post content")) { + $links[] = "". t("create blog entry") .""; + } + + if ($type == "menu.view" && user_access("access content")) { + $links[] = "uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view personal blog") .""; } if ($type == "node" && $node->type == "blog") { diff --git a/modules/queue.module b/modules/queue.module index 8d2fdbfa5..d03ea647b 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -19,7 +19,7 @@ function queue_perm() { } function queue_link($type) { - if ($type == "menu" && user_access("access submission queue")) { + if ($type == "menu.view" && user_access("access submission queue")) { $links[] = "". t("submission queue") ." (". queue_count() .")"; } diff --git a/modules/tracker.module b/modules/tracker.module index 1daf00944..c61f17fac 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -3,7 +3,7 @@ function tracker_link($type) { - if ($type == "menu") { + if ($type == "menu.view") { $links[] = "". t("recent comments") .""; } diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 1daf00944..c61f17fac 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -3,7 +3,7 @@ function tracker_link($type) { - if ($type == "menu") { + if ($type == "menu.view") { $links[] = "". t("recent comments") .""; } diff --git a/modules/user.module b/modules/user.module index c538b5d09..54e9c1f72 100644 --- a/modules/user.module +++ b/modules/user.module @@ -458,19 +458,8 @@ function user_block() { $output .= "
\n"; - foreach (module_list() as $name) { - if (module_hook($name, "link")) { - $links = module_invoke($name, "link", "menu"); - foreach ($links as $link) { - $output .= "$link
\n"; - } - } - } - - if (user_access("access administration pages")) { - $output .= "
\n"; - $output .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; - } + $links = array_merge(module_invoke_all("link", "menu.create"), array(""), module_invoke_all("link", "menu.view"), array(""), module_invoke_all("link", "menu.settings"), array(""), module_invoke_all("link", "menu.misc")); + $output .= @implode("
\n", $links); $output .= "
"; } @@ -499,9 +488,16 @@ function user_link($type) { $links[] = "". t("user account") .""; } - if ($type == "menu") { + if ($type == "menu.settings") { $links[] = "". t("account settings") .""; - $links[] = "
". t("logout") .""; + } + + if ($type == "menu.misc") { + if (user_access("access administration pages")) { + $links[] = "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) .""; + } + + $links[] = "". t("logout") .""; } if ($type == "admin" && user_access("administer users")) { diff --git a/modules/user/user.module b/modules/user/user.module index c538b5d09..54e9c1f72 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -458,19 +458,8 @@ function user_block() { $output .= "
\n"; - foreach (module_list() as $name) { - if (module_hook($name, "link")) { - $links = module_invoke($name, "link", "menu"); - foreach ($links as $link) { - $output .= "$link
\n"; - } - } - } - - if (user_access("access administration pages")) { - $output .= "
\n"; - $output .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; - } + $links = array_merge(module_invoke_all("link", "menu.create"), array(""), module_invoke_all("link", "menu.view"), array(""), module_invoke_all("link", "menu.settings"), array(""), module_invoke_all("link", "menu.misc")); + $output .= @implode("
\n", $links); $output .= "
"; } @@ -499,9 +488,16 @@ function user_link($type) { $links[] = "". t("user account") .""; } - if ($type == "menu") { + if ($type == "menu.settings") { $links[] = "". t("account settings") .""; - $links[] = "
". t("logout") .""; + } + + if ($type == "menu.misc") { + if (user_access("access administration pages")) { + $links[] = "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) .""; + } + + $links[] = "". t("logout") .""; } if ($type == "admin" && user_access("administer users")) { -- cgit v1.2.3