I have a views, it contain three different displays:

display_id access php code overridden access control
default return true; No
block_1 return true; No
block_2 return false; Yes

 

And both block_1, and block_2 are enabled in the current theme.

  block_1 block_2
Expectation visible invisible
Observation visible visible ??

 

Reason:
I checked the access function in views_php_plugin_access.inc:

  function access($account) {
		
    if (!empty($this->options['php_access'])) {
			print_r($this->view->name);
			print_r('<br>');
			print_r($this->view->current_display);
			print_r('<br>');
      return views_php_check_access($this->options['php_access'], $this->view->name, $this->view->current_display, $account);
    }
    return TRUE;
  }

And found out that, no matter for which display( block_1, block_2), $this->view->current_display == 'default', which means that:
the php access plugin will always use the php code for default display to determine the accessibility of any other displays, even if the display has overridde php access code.

Comments

foredoc’s picture

Could this be a bug of views?

Because I also checked the views_plugin_access_role.inc, it has the same problem:

Always tend to the access setting of the default display.

Thanks.

foredoc’s picture

Anyone has similar problem?

Thanks.

Liam Morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.