This is really bizarre and I'm very stressed trying to figure it out. Every time I create a new view or clone a view, they are output after load with the same name.

This first manifested itself when I started noticing broken layouts. I inspected each view object before theming, and they all seem to be given the same name, despite obviously not being the same view.

There was some data corruption a few days ago on the db, but I have checked through it and can't see any reference in the database to the view name which is being output instead of the real one.

I'm really confused by this, could somebody point me in the right direction?

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please give more informations...

Every time I create a new view or clone a view, they are output after load with the same name.

How do you do it?

I inspected each view object before theming, and they all seem to be given the same name, despite obviously not being the same view.

What happens if you edit them in the admin interface, are they the same there, too?

cameron tod’s picture

Ok, so creating:

Go to admin/build/views/add. Create a view with a certain name (lets call it test). Set some basic info for demo purposes:

$view = new view;
$view->name = 'test';
$view->description = '';
$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('filters', array(
  'status' => array(
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'relationship' => 'none',
  'build_mode' => 'teaser',
  'links' => 1,
  'comments' => 0,
));

Now I'll demo it in the Ajax preview area, and see what comes out in the views header:

<div class="view view-page-providers view-id-page_providers view-display-id-default view-dom-id-1">

If I output the view at view load time (by using print_r in view.inc), the name is incorrect again. I have checked in views_view and views_display and there is no reference to the other view (which I have since deleted).

It doesn't appear to be being renamed by the theme layer OR the module layer beyond theming. I guess I could try disabling modules one by one to see if that helps...but it really does seem to be happening high up the chain. Weird I know.

cameron tod’s picture

Woops sorry guys.

You know how the act of explaining something can help you think it through? Well...here's the line that was causing all the trouble

  if ($view->name == 'page_businesses' ||  $view->name = 'page_providers') {

In a hook_views_query_alter.

So I've now changed it to:

  if ($view->name == 'page_businesses' ||  $view->name == 'page_providers') {

Thanks for any help! I needed it!

cameron tod’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)