I have a View that I only want the content visible only to a certain dept. For logged in users, my filters work perfectly. Other users should see the empty text. I've tried using the options on this issue http://drupal.org/node/340815 (that I apparently tried to hijack though it is regarding the same subject) to make my View not visible to anonymous viewers - both by User Name (Anonymous) and Created Date (before admin created date) filters. Neither options are working to show the anonymous viewers the empty text. In the database, the name field is blank and the created date is 0 for UID 0. Here is my View and thanks in advance for any guidance.

$view = new view;
$view->name = 'box_competitors_scic_outisedPMM';
$view->description = '';
$view->tag = 'box';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'body' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'body',
    'table' => 'node_revisions',
    'field' => 'body',
    'relationship' => 'none',
  ),
  'field_link_url' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_link_url',
    'table' => 'node_data_field_link',
    'field' => 'field_link_url',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'tab_box' => 'tab_box',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'value' => array(
    'operator' => 'in',
    'value' => array(
      'Product Management and Marketing' => 'Product Management and Marketing',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'value',
    'table' => 'profile_values_profile_department',
    'field' => 'value',
    'relationship' => 'none',
  ),
  'tid' => array(
    'operator' => 'or',
    'value' => array(
      '208' => '208',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'type' => 'select',
    'limit' => TRUE,
    'vid' => '17',
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'hierarchy' => 0,
    'relationship' => 'none',
    'reduce_duplicates' => 0,
  ),
  'uid' => array(
    'operator' => 'not in',
    'value' => array(
      '0' => 0,
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'uid',
    'table' => 'users',
    'field' => 'uid',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Competitors');
$handler->override_option('empty', 'This is my empty text');
$handler->override_option('empty_format', '2');
$handler->override_option('items_per_page', 1);
$handler->override_option('distinct', 1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'box-competitorsscic');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));

Comments

merlinofchaos’s picture

Status: Active » Fixed

You must be confused. The filters applied aren't going to be for the current user, they're going to be for the user in the query. If it's a node view, that means the node author. So you'd be filtering out (or only to) nodes authored by anonymous.

If you want to change the visibility of a view, that's the 'access' setting.

tbertin’s picture

Status: Fixed » Active

When I tried that earlier, the anonymous user saw no view. Is there anyway for them to see the empty text with access settings?

esmerel’s picture

Status: Active » Fixed

You might try using a panel, it could be easier. You can set specific access/visibility rules based on roles.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.