--- announcements.module.orig 2008-07-09 20:11:58.000000000 -0500 +++ announcements.module 2008-09-26 23:55:55.000000000 -0500 @@ -108,29 +108,19 @@ function announcements_node_info() { * * More detail at @link http://api.drupal.org/api/HEAD/function/hook_access API page @endlink . */ -function announcements_access($op, $node, $account) { +function announcements_access($op, $node, $account = NULL) { global $user; - - switch ($op) { - case 'create': - return user_access('create announcement'); - - case 'view': - return user_access('access content'); - case 'update': - case 'delete': - // 'Edit own' is by default. - if ($user->uid == $node->uid || user_access('edit announcement')) { - return true; - } - else { - return false; - } - - default: - return false; + if ($op == 'create' && user_access('create announcement')) { + return TRUE; + } + if ($op == 'update' || $op == 'delete') { + if ($user->uid == $node->uid || user_access('edit announcement')) { + return TRUE; + } } +// Don't return FALSE by default. Allow node_access() to check the node access tables. This permits other node access modules to determine access + } /** @@ -533,7 +523,7 @@ function announcements_block($op = 'list $limit = variable_get('announcements_block_max_list_count', 3); $result = db_query_range($q, $qargs, 0, $limit + 1); while ($announcement = db_fetch_object($result)) { - $announcement_items[] = node_load($announcement->nid); + $announcement_items[] = node_load($announcement->nid); } $num_found = count($announcement_items); if ($num_found > $limit) { @@ -730,8 +720,10 @@ function theme_announcements_compact($an function theme_announcements_block_list($announcement_list) { $output = null; foreach ($announcement_list as $announcement) { - $output .= '

'. l($announcement->title, 'node/'. $announcement->nid) .'

'; - $output .= theme('announcements_abstract', $announcement); + if (node_access('view', $announcement) != FALSE) { + $output .= '

'. l($announcement->title, 'node/'. $announcement->nid) .'

'; + $output .= theme('announcements_abstract', $announcement); + } } return $output; }