I have created a node view so that I can list my own content type called properties. I seem to have done everything right (analysis doesn't throw up any problems) and when I'm in administrator view the view works fine.

However when I try to look at it as an anonymous user I just get a red box that says this " warning: Invalid argument supplied for foreach() in /hsphere/local/home/staging/landj.staging.eurekastep.com/modules/views/theme/views-view-fields.tpl.php on line 22. " four times.

I haven't a clue what to do with this, and I really need this view to work (soon). If anyone could help me (I have little experience with code btw) I'd be totally grateful

Sammy

Comments

merlinofchaos’s picture

Can you please export the view that does this? I can't really do much with just the error message.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)
eLiTeGuRu’s picture

I have the same issue.
My exported view is:

$view = new view;
$view->name = 'links_religion';
$view->description = 'links';
$view->tag = '';
$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(
'field_link_url' => array(
'label' => '',
'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',
),
'field_desc_value' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_desc_value',
'table' => 'node_data_field_desc',
'field' => 'field_desc_value',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'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(
'links_religion' => 'links_religion',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler->override_option('row_options', array(
'inline' => array(
'field_link_url' => 'field_link_url',
'field_desc_value' => 'field_desc_value',
),
'separator' => '-',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'Messages_FramrozePatel');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));

Thanks, any help is appreciated

eLiTeGuRu’s picture

Status: Postponed (maintainer needs more info) » Active
justafish’s picture

I have the same problem for every view I've made. I get the same error each time saying:

warning: Invalid argument supplied for foreach() in /home/chrootusers/home/justafish/tangram/sites/all/modules/views/theme/views-view-fields.tpl.php on line 22. 

Once for each view field that I should be seeing.

I've attached exports of all my views.

merlinofchaos’s picture

Can you please export the view?

eLiTeGuRu’s picture

I thought I exported it in post #3, did I do something wrong?

justafish’s picture

as had I...

merlinofchaos’s picture

Whoa, sorry. That message went onto the wrong post.

(Heh. I have to say it a lot).

kriskd’s picture

I just had the same thing happen to me. No error when viewing while logged in, but I get the error when logged out. What I'm attempting to do is display images from an imagefield. Here is my View:

$view = new view;
$view->name = 'clients_imagefield';
$view->description = 'Client logos using image field instead of image mod.';
$view->tag = '';
$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(
  'field_logo_fid' => array(
    'label' => '',
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'client_logo_thumbs_default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_logo_fid',
    'table' => 'node_data_field_logo',
    'field' => 'field_logo_fid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'title' => array(
    'order' => 'ASC',
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    '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',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'client_info' => 'client_info',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('header', 'Just a sampling of the companies that get whirligigged on a regular basis.  We just don\'t do them for 1 or 2 members...we have over 200 customers - you want referrals, we have \'em');
$handler->override_option('header_format', '1');
$handler->override_option('items_per_page', 0);
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('header', 'Just a sampling of the companies that get whirligigged on a regular basis.  We just don\'t do them for 1 or 2 members...we have over 200 customers - you want referrals, we have \'em');
$handler->override_option('header_format', '1');
eLiTeGuRu’s picture

I finally was able to fix this issue. Apparently, anonymous users didn't have access to view the fields.

Steps:
1. Administer
2. Permissions (Under User Management)
3. Looks for your fields (Under content_permissions module)
4. Give anonymous the privilege to view the field.

Hope this helps others.

kriskd’s picture

Status: Active » Fixed

Oh my gosh -- I feel silly! That was totally my issue!

I marked this as "fixed". Hope that is okay with the original poster, otherwise I'm sure it can be opened again. :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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