Drupal Updates

Tuesday, January 17, 2012

Unable to update users_roles table from hook_user

Description:
Following code for hook_user was not working on one installation of drupal :
function testform_user($type, &$edit, &$user, $category = NULL) {
switch ($type) {
case 'insert':
$sql = 'INSERT INTO {users_roles} (uid, rid) values (%d, %d)';
db_query($sql, $user->uid, 3);
break;
}
}

The values just will not insert into the database. No error messages, nothing. Suspected a module conflict.
Solution:
Isolated the issue to the ‘workflow_ng’ module. I didn’t need the module so disabling it fixes it for me.

No comments:

Post a Comment