Last Updated: February 25, 2016
·
344
· toby wild

Access by permission

In my Drupal 7 module I only want code to execute for people who have a certain permission, in this case 'administer users'.

if (user_access('administer users')) {
 // Do something awesome
} else {
  //Do something less awesome
}