Skip to content

Instantly share code, notes, and snippets.

@johnrobertwilson
Created November 7, 2011 21:57
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null
/**
* Add a "silverpop form bean creators" role for users who can create beans of silverpop_form type.
*/
function energy_content_update_7046(&$sandbox) {
$perms = array();
$new_role = new stdClass();
$new_role->name = 'silverpop form block creators';
$status = user_role_save($new_role);
$perms = array();
$perms[] = 'create any silverpop form bean';
$perms[] = 'edit any silverpop form bean';
$perms[] = 'view any silverpop form bean';
$perms[] = 'delete any silverpop form bean';
bean_reset();
if ($status) {
$role = user_role_load_by_name($new_role->name);
debug($role->rid);
user_role_grant_permissions($role->rid, $perms);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment