【问题标题】:Template script to make it visible only to admin on shopify模板脚本,使其仅对 shopify 上的管理员可见
【发布时间】:2015-05-27 21:26:17
【问题描述】:

我想让 shopify 上的模板仅对管理员可见。 我可以让它只对客户可见,但现在只需要管理员代码。

我使用的客户代码是:

{% unless customer %}
    {% if template contains 'customer' %}
        {% assign send_to_login = false %}
    {% else %}
        {% assign send_to_login = true %}
    {% endif %}
{% endunless %}

{% if send_to_login %}
<meta content="0; url=/account/login?checkout_url={{ shop.url }}" http-equiv="refresh" />
{% else %}
==== Page Content ===
{% endif %}
//The code above asks to the user to login if they visit this template 

现在可以为管理员制作类似的东西吗?管理实体的名称是什么?例如,这里的实体客户是“客户”。我应该如何在代码中声明管理员? 提前致谢。

【问题讨论】:

    标签: javascript php web-applications shopify


    【解决方案1】:

    查看以下类似问题:

    目前没有像您可以为客户检查管理员的好方法。您的选项是tag your customers as admins,仅当客户具有管理员标签时才显示您的模板,或者check against the customer's email address 以确定他们是否是管理员。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-14
      • 1970-01-01
      • 1970-01-01
      • 2014-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多