Search code examples
bloggerblogspot

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.


Solution

  • 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.