code for some role by id

Public

for example, this snippet for custom role 'manager' (id - 4)

Get raw version
php
  1. <?php global $user;
  2. if (array_key_exists(4, $user->roles)) // 4 - id for role "manager". if ($user->roles == 'manager')
  3. {
  4. // do something for role 'manager'
  5. }
  6. else {
  7. // do for other role
  8. }
  9. ?>