Check if admin or not / custom permissions

We're upgrading our support forum. Replies are currently closed. Please view our Documentation and FAQ using the menu above.



I’m trying to design a theme for the client portal, in some parts I need to display things for customers but not for admin or the opposite, things that I can’t do it with rules.

How can I check if the current logged user is an admin or a customer?
for example in design_header page ?


I’ve found this and it works fine till now, but I’m not 100% sure if I’m doing it right or not


<?php if(module_security::get_loggedin_id() ==1) {

// do stuff for admin



but what about if I want to check if the user is a customer or not ?
because I just want to make changes on the theme for customers, not for any other users (ex: moderator)

The UCM system doesn’t really know between “admin” or “non-admin”. It is all based on individual permissions.

eg: Can the current user view the customer listing?
if(module_customer::can_i(‘view’,’Customers’)){ …

eg: Can the current user create a new customer?
if(module_customer::can_i(‘create’,’Customers’)){ …

eg: Can the current user view the Config Settings area of UCM?
if(module_config::can_i(‘view’,’Settings’)){ …

eg: Can the current user create new system users?
if(module_user::can_i(‘create’,’Users’,’Config’)){ …

have a hunt through the code for any other can_i bits if you need further examples.

There’s also another can_user call, which checks those individual tickboxes in the User Role area on the right, eg:

module_security::can_user(module_security::get_loggedin_id(),’Show Quick Search’)
module_security::can_user(module_security::get_loggedin_id(),’Can User Login’)

You can even create your own, and it will show up in a tickbox in User Roles, eg:

module_security::can_user(module_security::get_loggedin_id(),’My Custom Permission’)

Good luck!


I got the idea. I’ll try to do it depending on what you just said.

Thanks a lot!

The forum ‘Custom Development’ is closed to new topics and replies.

iahmadCheck if admin or not / custom permissions