In Drupal 7, I am making an attempt to grant a permission to a consumer position utilizing hook_install and it would not work. However it works with hook_enable. Are you aware tips on how to make it work with hook_install as nicely?
perform porta_batch_editor_install() { $permissions = array('entry porta batch editor'); //grant 'entry porta batch editor' permission to pb position foreach(array('pb position') as $role_name) { $position = user_role_load_by_name($role_name); user_role_grant_permissions($role->rid, $permissions); } }
It really works with Drupal Developer following method:
perform porta_batch_editor_enable() { $permissions = array('entry porta batch editor'); //grant 'entry porta batch editor' permission to pb position foreach(array('pb position') as $role_name) { $position = user_role_load_by_name($role_name); user_role_grant_permissions($role->rid, $permissions); } }