Guys, what is the problem with that code?
// Create a Power User.
$power_user_role = new stdClass();
$power_user_role->name = 'power user';
$power_user_role->weight = 3;
user_role_save($power_user_role);
// Set permissions to power user
user_role_grant_permissions($power_user_role->rid, array(
'access administration pages',
'access backup and migrate',
'access backup files',
'access content',
'access content overview',
'access dashboard',
......................
'use advanced search',
$filtered_html_permission));
It throws me
"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null: INSERT INTO {role_permission} (rid, permission, module)" in user_role_grant_permissions()
But user_role_grant_permissions() ONLY needs 2 parameters not the module
http://api.drupal.org/api/drupal/modules!user!user.module/function/user_...
Comments
I too would love to know the
I too would love to know the answer to this question.