I'm executing the following code in hook_init:

function my_module_init(){
    global $user;

    $apprenticeship = user_access('prevent publishing apprenticeship job', $user);
    drupal_set_message("CHECKING permission[prevent publishing apprenticeship job]: " . $apprenticeship);
    $content = user_access('access content', $user);
    drupal_set_message("CHECKING permission[access content]: " . $content);

I am logged in as USER#1 and the prevent publishing apprenticeship job permission is NOT set for user#1.

However, each time my code executes user_access('prevent publishing apprenticeship job', $user) returns 1 i:e true.

As I said, that permission is not set for for the administrator role.

Can anyone help and point out what I'm missing or doing wrong?


The access content also returns 1 but that is set for the administrator role.


The user #1 is special, in Drupal. It will always have all permissions, even the ones not explicitly set for the administrator role.

See user_access() source code.

  // User #1 has all privileges:
  if ($account->uid == 1) {
    return TRUE;
| improve this answer | |
  • Thanks TytooF. I suspected! User#1 or not user_access should probably be true to the values set on the permissions page. – sisko Aug 4 '16 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.