# Need some conditional for checking User Role and Logged In Status

**URL:** <https://forums.knack.com/t/need-some-conditional-for-checking-user-role-and-logged-in-status/6668>\
**Category:** API & Custom Code\
**Created:** [August 24, 2019, 3:39pm UTC](https://forums.knack.com/t/need-some-conditional-for-checking-user-role-and-logged-in-status/6668 "2019-08-24T15:39:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnMarcel13890](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/johnmarcel13890/32/271_2.png) [@JohnMarcel13890](https://forums.knack.com/u/JohnMarcel13890)\
**Post date:** [August 24, 2019, 3:39pm UTC](https://forums.knack.com/t/need-some-conditional-for-checking-user-role-and-logged-in-status/6668/1 "2019-08-24T15:39:21Z")

</div>

I have knack app embedded in our website. Trying to learn how to check user role and logged in status, and use a conditional to show a specific nav bar based on that.

I am trying to build some solution to do the following however I am not really a JS programmer. Any help is greatly appreciated.  
  
if user is logged in AND has user role(s) = Admin {  
 then do something  
} else if user is logged in AND has user role(s) = Manager OR Team Lead OR Support {  
 then do something different  
} else is user is logged in AND has user role(s) = Client {  
 then do yet again something different  
} else is user if logged out {  
 then do this  
}  
endif

---

<div class="post-metadata">

**Author:** ![BradStevens](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/bradstevens/32/140_2.png) [@BradStevens](https://forums.knack.com/u/BradStevens)\
**Post date:** [August 27, 2019, 7:03pm UTC](https://forums.knack.com/t/need-some-conditional-for-checking-user-role-and-logged-in-status/6668/2 "2019-08-27T19:03:52Z")

</div>

Hi John,

We do this quite a bit both in JS and using form rules - I'd try the latter first of course.

But if you must resort to javascript then check out the utility functions in the devbeloper docs getUserAttributes and getUserRoles here [https://www.knack.com/developer-documentation/#retrieving-user-properties-utility](https://www.knack.com/developer-documentation/#retrieving-user-properties-utility)

Brad
