Find out if User is a Sudo user

hearty fare

Sudo User

Here's a nice little function to determine if a Manager user is also a Sudo user.

Jens Wolff asked...

Is there an API-Call to check if the currently logged user is a sudo-user in the backend?

The Solution:

BobRay says...

Try this:

    if ($modx->user->get('sudo'))
      { ... }

What's the Story?

MODX provides a modUser object for the current user. And every user has a "sudo" field in his database record, so using the basic "get" object method will return 1 if he is a Sudo user or 0 if he is not.