Drupal 允许查看未发布的内容

发布于 2024-08-09 14:22:22 字数 239 浏览 5 评论 0原文

我继承了 Druapl5 网站,并且在编辑内容表单的“发布选项”部分中未选中发布时显示内容。

我确认该节点的数据库中的状态为 0。所以它应该是不可见的。

我的第一个猜测是我已登录,这就是为什么我可以看到它,但我注销后仍然可以看到它。我尝试了不同的浏览器和相同的东西,所以不是那样的。

此外,未发布的节点出现在搜索结果中,我最初认为这是过时的搜索缓存,但可能有所不同。

见过这样的事情吗?有什么想法吗?

I inherited a Druapl5 site and it's showing content when published is not checked in the Publishing Options section of the Edit Content Form.

I confirmed that the status is 0 in the DB for the node. So it should be not visible.

My first guess was that I was logged in and that's why I could see it, but I logged out and I could still see it. I tried a different browser and the same thing so it's not that.

Also, the unpublished nodes are coming up in the search results which I originally thought was an out of date search cache, but may be something different.

Ever seen anything like this? Any ideas?

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

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

发布评论

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

评论(5

轻许诺言 2024-08-16 14:22:22

您在评论中提到网站上安装了内容访问。该模块(以及其他几个模块,例如 ACL)会覆盖默认的 Drupal 节点访问机制,以便提供额外/更细粒度的权限设置。

所以我的猜测是该模块中的权限配置对于您想要的结果配置错误。据我记得,它允许每个内容类型(为作者和角色定义)单独的权限集。您应该查看您的内容类型编辑/定义页面 - 该模块应该添加一个选项卡来配置权限。另请检查模块的 readme.txt,因为它可能会提供一些额外的提示。

如果这没有帮助,您应该检查是否还安装了其他节点访问模块。如前所述,它们的数量相当多,并且它们的相互作用不容易确定(如果可能的话,应该只使用一种)。

You mentioned in a comment that Content Access is installed on the site. This module (as well as several others, e.g. ACL) overrides the default Drupal node access mechanism in order to provide additional/more fine grained permission settings.

So my guess is that the permission configurations in that Module are configured wrong for your desired results. As far as I recall, it allows separate permission sets per content type (defined for authors and roles). You should look at your content type edit/definition pages - there should be a tab added by that module to configure the permissions. Also check the readme.txt of the module, as it might give some additional hints.

If that does not help, you should check if other node access modules are installed as well. As mentioned, there are quite a few of them, and their interactions are not easy to determine (One should aim to use only one, if possible).

只有一腔孤勇 2024-08-16 14:22:22

您使用视图吗?如果是这样,请确保您的过滤器设置为仅显示已发布的内容。

我在评论中遇到了类似的问题,这导致了一些极好的垃圾邮件机会,直到我发现它。

Are you using Views? If so, make sure you have a filter set to show Published only.

I ran in to a similar problem with comments, which lead to some excellent spamming opportunities until I discovered it.

对岸观火 2024-08-16 14:22:22

比较奇怪。没有答案,只有猜测:

尝试访问 admin/content/node-settings 并单击“重建权限”。

也许清除缓存管理/设置/性能

Rather strange. No answers, only guesses:

Try accessing admin/content/node-settings and click on Rebuild permissions.

And maybe clear the cache admin/settings/performance

痴者 2024-08-16 14:22:22

检查您对匿名用户的权限。似乎他们在某个地方拥有错误的权限。

Check your permissions for anonymous users. Seems like somewhere they have the wrong permisions.

偏闹i 2024-08-16 14:22:22

所有访问模块在使用 hook_node_access() 时都会覆盖默认设置。很可能这就是问题所在。因此,您需要调整内容访问部分中的这些设置。

这不是最好的解决方案。但如果您在此期间需要一些东西,您可以随时将此代码放入 node.tpl.php 文件中:

if(!$node->status && $user->uid != 1){

添加代码:

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">

<?php print $picture ?>
<?php

if(!$node->status && $user->uid != 1){

?>
<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

  <div class="meta">
  <?php if ($submitted): ?>
    <span class="submitted"><?php print $submitted ?></span>
  <?php endif; ?>

  <?php if ($terms): ?>
    <span class="terms"><?php print $terms ?></span>
  <?php endif;?>
  </div>

  <div class="content">
    <?php print $content ?>
  </div>

<?php
  if ($links) {
    print $links;
  }
}//if for published node
?>

</div>

All access modules override the default settings while using hook_node_access(). Most likely this is the problem. So you need to tweak those settings in the content access portion.

And this is not the best solution. But if you need something in the interim you can always put this code in the node.tpl.php file:

if(!$node->status && $user->uid != 1){

with code added:

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">

<?php print $picture ?>
<?php

if(!$node->status && $user->uid != 1){

?>
<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

  <div class="meta">
  <?php if ($submitted): ?>
    <span class="submitted"><?php print $submitted ?></span>
  <?php endif; ?>

  <?php if ($terms): ?>
    <span class="terms"><?php print $terms ?></span>
  <?php endif;?>
  </div>

  <div class="content">
    <?php print $content ?>
  </div>

<?php
  if ($links) {
    print $links;
  }
}//if for published node
?>

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