show node title to unregistered users

允我心安 提交于 2020-01-06 08:41:39

问题


I'm using content access module to restrict certain nodes and node types for un-registered users.

But I would like to create a view where unregistered users can also see titles of those restricted nodes.

How can I do this ?


回答1:


I haven't used this personally, but I just saw it pop up in the drupal.org module feed a few days ago, and it should help: http://drupal.org/project/views_ignore_node_permissions




回答2:


ok if you just want to echo the node title in php (with in the node body ) enable php then :

<?php 
if (arg(0) == 'node' && is_numeric(arg(1))) $nodeid = arg(1);
$node = node_load($nodeid);
print $node->title;

?>

Blockquote

and you are done




回答3:


If you want to restrict access to some fields and not to others, you really should be using permissions per field. I assume all fields are built with CCK, so just enable permission for the content-type, but disable for all fields.

That way, only the title is visible. I don't think you can disable permissions for the standard body field, but I always use a CCK text-area for that anyway, it's alot easier also for css since the standard body field isn't wrapped in default node printing.




回答4:


You can write a simple module for this, which does the following:

  • query the node titles you want to show (called by hook_menu)
  • theme the result (hook_theme)
  • display the result (hook_block)

in the hook_perm you can create a new permission who you would like to show the node titles, if it is for everybody, just use 'access content'.




回答5:


The solution is here:

In the views "Query options"-settings it's possible to set "Disable SQL rewriting" ("Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().") which afaik makes this module unneeded with the latest views version.



来源:https://stackoverflow.com/questions/3460976/show-node-title-to-unregistered-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!