向未注册用户显示节点标题

发布于 2024-09-14 02:36:42 字数 175 浏览 4 评论 0原文

我正在使用 内容访问 模块来限制未注册用户的某些节点和节点类型。

但我想创建一个视图,未注册的用户也可以看到这些受限节点的标题。

我该怎么做?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

凡间太子 2024-09-21 02:36:42

我个人没有使用过这个,但几天前我刚刚看到它在 drupal.org 模块提要中弹出,它应该有所帮助:http://drupal.org/project/views_ignore_node_permissions

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

歌入人心 2024-09-21 02:36:42

好的,如果您只想在 php 中回显节点标题(在节点主体中)启用 php
然后 :

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

?>

块引用

就完成了

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

壹場煙雨 2024-09-21 02:36:42

如果您想限制对某些字段的访问而不限制对其他字段的访问,那么您确实应该使用每个字段的权限。我假设所有字段都是使用 CCK 构建的,因此只需启用内容类型的权限,但禁用所有字段。

这样,只有标题可见。我不认为你可以禁用标准主体字段的权限,但无论如何我总是使用 CCK 文本区域,对于 css 来说也更容易,因为标准主体字段没有包含在默认节点打印中。

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.

[浮城] 2024-09-21 02:36:42

您可以为此编写一个简单的模块,它执行以下操作:

  • 查询您想要显示的节点标题(由 hook_menu 调用)
  • 主题 结果 (hook_theme)
  • 显示结果 (hook_block)

在您的 hook_perm 中 可以创建一个新的权限来显示您想要显示的节点标题,如果它适用于所有人,只需使用“访问内容”即可。

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'.

薆情海 2024-09-21 02:36:42

解决方案位于此处

在视图“查询选项”设置中,可以设置“禁用 SQL 重写”(“禁用 SQL 重写将禁用 node_access 检查以及实现 hook_query_alter() 的其他模块。”),这使得该模块不再需要最新的视图版本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文