Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When removing a user form a Role in Drupal, you get this error in 4.2.8.
Fatal error: Call to undefined function civicrm_api() in civicrm_starterkit/modules/civicrm/drupal/modules/civicrm_group_roles/civicrm_group_roles.module on line 590
This does not happen in 4.3-beta3, but not sure why. The function causing the error appears the same...
/**
* Helper function to add and remove users from groups, use after user_save to remove roles $roles = $edit['roles'] for user_save
* @roles list of role to add/remove
* @user Drupal user object
* $op either add or remove
*/
function civicrm_group_roles_add_remove_groups($roles, $user, $op) {
if ($op == 'add') {
$txt = 'added';
}
elseif ($op == 'remove') {
$txt = 'removed';
}
else {
return;
}
$debug_mode = FALSE;
// make sure user has other roles other than authenticated
if ($roles) {
//find the contact record
$params = array('version' => 3, 'sequential' => 1, 'email' => $user->mail );
$contact = civicrm_api('contact', 'get', $params);
Comment | File | Size | Author |
---|---|---|---|
#1 | 1948504-civicrm_group_role-error-when-removing-role.patch | 355 bytes | kreynen |
Comments
Comment #1
kreynen CreditAttribution: kreynen commentedadding civicrm_initialize() at the beginning of the function solved the problem
Comment #2
kreynen CreditAttribution: kreynen commentedFix committed http://drupalcode.org/project/civicrm_starterkit.git/commit/19962dd
Comment #3
kreynen CreditAttribution: kreynen commentedComment #3.0
kreynen CreditAttribution: kreynen commentedremoved ca path