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
}
Written by toby wild
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Drupal
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#