(I tried to post this to the Views Project, but the component list was mismatched to Views and so persistently gave an error.)

I created a very simple Views list of Books on my site (Filter: Book Depth = 1)--an index of books. It is visible to all registered users, but not to anonymous users (who get only a white page). Access is set to "unrestricted." Permissions >> Access All Views is checked for all roles, including anonymous.

This error is very similar to one I reported earlier (node/285066), where the access concerned a list of forms.

I could live without the other functionality, but this poses a very big problem for my content: I obviously want everyone to be able to read the material--and they need an index to do that.

If this can't be fixed, is there some way to hack a permission for a single URL-aliased page or Views-page?

Steve Hays
Ohio University

CommentFileSizeAuthor
#8 bennybobw_views_export.txt3.47 KBbennybobw

Comments

Anonymous’s picture

stevehays’s picture

PhP error log reveals the following about this bg:

[31-Jul-2008 07:24:09] PHP Fatal error: Cannot access empty property in /Applications/MAMP/htdocs/drupal/sites/default/modules/views/modules/node.views.inc on line 557

which seems to refer to

/**
* Render whatever the data is as a link to the node.
*
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, $values) {
if (!empty($this->options['link_to_node'])) {
return l($data, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE));
}
else {
return $data;
}
}

Anonymous’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 6.3 » 6.x-2.x-dev
Component: user system » node data

What is calling render_link? My guess is that $this->aliases isn't an array yet.

merlinofchaos’s picture

Do you have an access control module installed, such as taxonomy access that might seem unrelated to this particular content?

stevehays’s picture

No. No modules concerned with access.

merlinofchaos’s picture

Can you export the view? I don't know what's going on here but maybe I can try to replicate this. I have a feeling that the issue is something with your site, but since I'm not sure where to lay the blame for the data not being visible, I don't know what's going on. It does appear that the white screen may be due to a views crash, but it's the kind of crash that should not be happening.

stevehays’s picture

I think this is what you want--my best effort at an export. Perhaps I should have saved it as an attachment. If that's the proper protocol, just tell me, and I'll do better in the future.

$view = new view;
$view->name = 'library_list';
$view->description = 'List of books in library';
$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(
  'title' => array(
    'label' => '',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'teaser' => array(
    'label' => '',
    'exclude' => 0,
    'id' => 'teaser',
    'table' => 'node_revisions',
    'field' => 'teaser',
    'relationship' => 'none',
  ),
  'timestamp' => array(
    'label' => '',
    'link_to_node' => 1,
    'comments' => 0,
    'exclude' => 0,
    'id' => 'timestamp',
    'table' => 'history_user',
    'field' => 'timestamp',
    'relationship' => 'none',
  ),
  'comment_count' => array(
    'label' => '',
    'set_precision' => FALSE,
    'precision' => 0,
    'decimal' => '.',
    'separator' => ',',
    'prefix' => '(',
    'suffix' => ' comments)',
    'exclude' => 0,
    'id' => 'comment_count',
    'table' => 'node_comment_statistics',
    'field' => 'comment_count',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'p' => array(
    'order' => 'ASC',
    'id' => 'p',
    'table' => 'book_menu_links',
    'field' => 'p',
    'relationship' => 'none',
  ),
  'weight' => array(
    'order' => 'ASC',
    'id' => 'weight',
    'table' => 'book_menu_links',
    'field' => 'weight',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'depth' => array(
    'operator' => '=',
    'value' => array(
      'value' => '1',
      'min' => '',
      'max' => '',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'depth',
    'table' => 'book_menu_links',
    'field' => 'depth',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'role',
  'role' => array(
    '1' => 1,
    '2' => 2,
    '17' => 17,
    '4' => 4,
    '15' => 15,
    '13' => 13,
    '16' => 16,
  ),
  'perm' => 'access administration menu',
));
$handler->override_option('title', 'The Library');
$handler->override_option('header', '<div class = "book_header"> The Library is a place to post reference materials for the <i>Assess OU</i> community: copies of or links to published materials; graphs; charts; financial reports; links to audio or video that serve as assessment evidence; etc.  These materials are available to the general public to read, but contributors are required to have permission from the site administrator. <i>Assess OU</i> actively solicits contributors to the Library.  If you are willing to take responsibility for contributing to books in the Library, please <a href = "mailto:admin@assessou.org">contact the site administrator</a>, Steve Hays.</div>');
$handler->override_option('header_format', '2');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'title' => 'title',
    'teaser' => 'teaser',
    'timestamp' => 'timestamp',
    'comment_count' => 'comment_count',
  ),
  'info' => array(
    'title' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'teaser' => array(
      'separator' => '',
    ),
    'timestamp' => array(
      'separator' => '',
    ),
    'comment_count' => array(
      'sortable' => 0,
      'separator' => '',
    ),
  ),
  'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'library');
$handler->override_option('menu', array(
  'type' => 'normal',
  'title' => 'Library',
  'weight' => '0',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));

[Edited to add PHP tags to make the export readable]

bennybobw’s picture

StatusFileSize
new3.47 KB

I'm getting this error too. I do have the Taxonomy Access Control Lite module enabled which writes to the node_access table. However, even after uninstalling the module, it still gives me the error. var_dump of $values gives me

object(stdClass)#70 (2) { ["nid"]=>  string(3) "285" ["nodequeue_nodes_node_position"]=>  string(1) "1" } 

So you're right, no aliases. I hacked it (for now) with

if(!empty($this->options['link_to_node']) && $this->aliases)

List of modules currently enabled:
cck and cck > text, devel, devel generate, image, image fupload, image gallery, image import, smtp, a custom module (no database stuff though), captcha, recaptcha, taxonomy image, tac_lite (disabled to test, after disabled, node access permissions were rebuilt), views, views_ui, jquery update

Attached is the export of my view. I grepped render_link -- but it didn't come up with anything that seemed useful to me. Just that render() calls render_link(). Let me know if I can help more on this (but I'll be out of town through labor day).

Thanks

merlinofchaos’s picture

Status: Active » Fixed

Permissions >> Access All Views is checked for all roles, including anonymous.

That allows all users to access all views. I don't think that is what you want. This setting should be checked only for administrators.

merlinofchaos’s picture

Status: Fixed » Active
merlinofchaos’s picture

Status: Active » Fixed

Ahh, the render_link call shouldn't be happying for anonymous users. THe problem here is the 'has new content' field which basically does nothing at all if the user is the anonymous user, since there is no such thing is new content to anonymous users. However, a render_link() got stuck outside of the if and it was trying to access data that is not part of the query in this case.

This is now fixed in -dev. If you need a workaround before dev, in views_handler_field_history_user_timestamp::render() move the call to return $this->render_link() up above the } that is just before it.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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