Using menu access check to determine context link visibility. 6.x-2.0-beta1
authoryoung hahn
Tue, 21 Apr 2009 21:47:27 +0000 (21:47 +0000)
committeryoung hahn
Tue, 21 Apr 2009 21:47:27 +0000 (21:47 +0000)
context.core.inc

index fa93f1b..b27105f 100644 (file)
@@ -485,10 +485,10 @@ function context_links($reset = false) {
       $types = node_get_types();
       // Iterate over active contexts
       foreach ($active_types as $type) {
-        $type_url = str_replace('_', '-', $type);
-        $add_url = 'node/add/'. $type_url;
-        if (isset($types[$type]) && strpos($_GET['q'], $add_url) === FALSE && node_access('create', $type)) {
-          $links[$type_url] = array('title' => $types[$type]->name, 'href' => $add_url);
+        $add_url = 'node/add/'. str_replace('_', '-', $type);
+        $item = menu_get_item($add_url);
+        if ($item && $item['access'] && strpos($_GET['q'], $add_url) !== 0) {
+          $links[$type] = array('title' => $types[$type]->name, 'href' => $add_url);
         }
       }
     }