You are here

function cf_menu_query_menu_tree_check_access_alter in Common Functionality 7

Implements hook_query_TAG_alter().

Why: The drupal menu core prevents administrators from seeing the unpublished nodes in the admin menu. See: http://drupal.org/node/460408#comment-4367202

Errata: This requires a patch against drupal core function (drupal-7.x-add_menu_tree_check_access-1.patch).

File

modules/cf_menu/cf_menu.module, line 67

Code

function cf_menu_query_menu_tree_check_access_alter(&$query) {
  if (user_access('view unpublished content in menu')) {
    $where =& $query
      ->conditions();
    foreach ($where as $key => &$value) {
      if (is_string($value['field']) && $value['field'] == 'n.status') {
        unset($where[$key]);
      }
    }
  }
}