Vianne
Vianne

Reputation: 578

Check for Admin privilege in Blogger

Is there a way to check whether a user is an administrator or not? Something like <b:if cond='data:post.admin'>. I would like to hide the widget edit icon to regular users.

Upvotes: 3

Views: 309

Answers (2)

Nixs
Nixs

Reputation: 39

You can restrict the content by using following condition:

data:cb.level.author != &quot;Anonymous&quot;

Upvotes: 0

Muhammad Saleh
Muhammad Saleh

Reputation: 792

There is no way to check user privilege in blogger than using blogger auto injected stylesheet authorization.css which generates a style to display class .blog-admin which was hidden in template for all users by default, this generated style override the default style in template when user is admin.

example:

in blog

enter image description here

for regular user it generates :

enter image description here

for admin user it generates :

enter image description here

The new blogger templates don't inject authorization.css stylesheet automatically anymore, so you have to add it manually if you're using a new blogger template.

The old blogger templates inject authorization.css stylesheet but in most of templates developers disabling it to avoid auto injected stylesheet bundle.css too.

So now, you have to detect the version of your template and check if authorization.css provided or disabled in first.

Upvotes: 2

Related Questions