d
Topic
Matt Member
Posts:
2
8 days ago

Is there code to detect admin/staff acounts for dev work?

I would love to have something like this logic so I could work on design/dev stuff and not show the world but i don't see any way to detect the user accounts. It can be done for a 'customer' but not an admin:

{% if current_user == me %}
show some stuff for me only
{% endif %}

I could do something like detect the current user (me) and get the user id of some kind then create an expression to show a block only when user id == my id. Anyone think of a waay to do this?

Shopify, if you are listening, there needs to be thought put towards creating some dev environments into the product so we don't have to do everything "live". Is there a way to show content only to our staff account?

i
Replies
Posts:
2
7 days ago

When you log in shopify you want it to show "Matt" or "Dealer" in a colored block of some sort?

tim Shopify Partner trezoro.co
Posts:
1944
7 days ago

Matt, 

there is a tool for this -- you mark a product as Unavailable for Online store -- this will effectively hide the product on your website. To see how the product page looks you should use the view icon at the top of product properties page in Admin.

However, there are ways to do what you want:

https://freakdesign.com.au/blogs/news/34154561-detect-if-shopify-admin-is-logged-in-using-liquid and a more extended approach:

https://stackoverflow.com/questions/17470921/howto-check-if-current-visitor-is-shops-admin

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)