简体   繁体   English

在drupal中为匿名用户隐藏价格和add_cart

[英]hide price and add_cart for anonymous user in drupal

如何在Drupal中为匿名用户隐藏价格和add_to_cart选项?

I think, You can go page dmin/people/permissions and uncheck this option for anonymous. 我认为,您可以进入dmin / people / permissions页,然后取消选中匿名选项。

To hide fields you can create node--YOUR_CONTENT_TYPE.tpl.php 要隐藏字段,您可以创建节点--YOUR_CONTENT_TYPE.tpl.php

In this template you can check user-role: 在此模板中,您可以检查用户角色:

global $user;

// Check if the user has the 'authenticated user' role.
if (in_array('authenticated user', $user->roles)) {
  //show your field 
}

Also you always can hide from css -) 你也总是可以从CSS隐藏-)

.not-logged-in .YOUR_CLASS_FIELD {display: none;} .not-logged-in .YOUR_CLASS_FIELD {display:none;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM