Check if a user has a particular role

jetFlow.io > Documentation  > Creating Workflows  > Check if a user has a particular role

Check if a user has a particular role

Sometimes we need to control how the workflow is executing based on the currently logged-in user role. That’s easy. There is a special variable {USER} that contains a list of currently logged in user details. So, we just need to specify a logic rule that checks {USER.roles} for a particular WordPress role name. You can configure this rule in the logic actions like Stop if and Run another workflow. See an example of how to stop the execution of the workflow if the currently logged-in user is not an administrator. Note that we use Not contains comparison because {USER.roles} is a list and we need to make sure it contains a string administrator.

Stop workflow with checking role of a current user

Stop workflow with checking role of a current user

The next example executes selected workflow conditionally if a current user has an administrator or editor role.

Run another workflow conditionally

Run another workflow conditionally

No Comments

Sorry, the comment form is closed at this time.