I am having some users who have access to a limited modules. Now after a user logs in, i want to alter the permissions of that user based on the uid. I mean i should be able to add or delete some permissions of that user immediately after a user logs in. Immediately after login i wrote a custom code which executes and returns a value whether the user is active or inactive. Then based on the result i should be able to delete some permissions to access some modules of my site if inactive or add if he is active.

  • Are they fine grained per-user? Seems like more of a job for user roles to be honest.
    – Chapabu
    Commented Oct 5, 2012 at 8:41
  • Yes, they are. Working on it but not able to solve.
    – Mr.M
    Commented Oct 8, 2012 at 8:37

1 Answer 1


user_role_grant_permissions can help you. Or you are using modules which grant permissions based on users not on roles? If yes, look into code of module which control permissions per user to find proper function

  • I am using drupal 6 and the function you suggested is for drupal 7 and more. By the way I'm not using any modules which grant permissions based on users.
    – Mr.M
    Commented Oct 10, 2012 at 5:19
  • 1
    Are you using user roles, if so you can achieve this by changing roles of user dynamically based on your conditions. Commented Oct 10, 2012 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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