Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • D Drupal
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 53
    • Issues 53
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Development
  • Drupal
  • Issues
  • #20
Closed
Open
Created May 16, 2018 by carbar1103@carbar1103

Manual synchronization of CiviCRM memberships and Drupal roles gives error

Hello.

I am just starting to get memberships and roles sorted out in my CiviCRM. When I go to Home » Administration » Configuration » CiviCRM » CiviMember Roles Sync » Manually Synchronize and click the button, I get a popup saying "There was an error. CiviMember Memberships and Drupal Roles could not be synchronized." The Drupal log just says "unknown error".

On investigation, the problem appears in drupal/modules/civicrm_member_roles/civicrm_member_roles.module, line 530, in the method _civicrm_member_roles_sync():

  $contacts = CRM_Core_DAO::executeQuery($sql, $params);
  if ($contacts->N == 0) {
    watchdog('civicrm_member_roles',
      $errorMsg,
      $errorParams,
      WATCHDOG_ERROR
    );
    return FALSE;
  }

It is running the following sql:

SELECT DISTINCT uf.contact_id, m.end_date FROM civicrm_uf_match uf
      LEFT JOIN civicrm_membership m ON uf.contact_id = m.contact_id
      WHERE m.id IS NOT NULL AND m.membership_type_id IN (1)
      ORDER BY m.end_date DESC

which is returning zero rows. This is probably because I haven't got the necessary roles/contacts/etc set up, but it is a bit of an odd error.

Regards,

Carl

Edited May 16, 2018 by carbar1103
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking