The module installed without a hitch, but I seem to have missed something.
A manual sync comes back with the following message:
There was an error. CiviMember Memberships and Drupal Roles could not be synchronized.
When I turn on "Synchronize when Drupal cron is ran" this message is emailed to me by cron:
Fatal error: Class 'CRM_Core_DAO' not found in /home/chelmsf/public_html/sites/default/modules/civimember_roles/civimember_roles.module on line 411
How should CiviCRM code be included in this? I have tried with and without CiviNode, in case that helped.
Running CiviCRM 1.9.12432, Drupal 5.7 and CiviMember Roles Sync 1.0. PHP version 5.2.3.
Great module, by the way - exactly what I was looking for now we are using CiviCRM for managing memberships.
Comments
Comment #1
Anonymous (not verified) commentedI will try to reproduce this.
Comment #2
Anonymous (not verified) commentedI have been able to reproduce the cron error and I am working on a patch. I'll post it as soon as I can.
The manual sync should still work, though. The error message you've posted should only show up when the module runs into database errors on Drupal's side. Can you confirm that the civimember_roles_rules table exists in your Drupal database? What database are you using for Drupal?
Comment #3
Anonymous (not verified) commentedPlease go here to download a patch to fix the cron error: http://drupal.org/node/217237
I am still interested in your other problem though. Once we have figured that out I will release another version that addresses these issues.
Comment #4
rallycivic commentedThanks. No messages from cron now.
I have "MySQL version 5.0.45-community". This is a cPanel 11 web host. I do have a civimember_roles_rules table, and it looks just the same as the settings in the .install file. I have 4 rules defined in it.
After installing that patch, I saw a choice for updating civimember_roles in the Drupal Database update script - I had this when I tried (on the ../update.php?op=finished page):
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/chelmsf/public_html/update.php on line 309.
* warning: Invalid argument supplied for foreach() in /home/chelmsf/public_html/update.php on line 542.
I realise from the .install file that the update was only to change the civimember_roles_sync_method setting, so this isn't anything to do with my failed manual update.
Comment #5
Anonymous (not verified) commentedAre you still unable to use the manual sync button? Have you been able to synchronize at all?
Yes, the update is intended to be used for people upgrading from the beta1 release. Did you previously have the beta1 release or are you just running a fresh install of 1.0?
Comment #6
rallycivic commentedYes, I did have the beta1 release installed first.
The manual sync button still results in that message, and I don't see any effect from the cron job, although there is no error in the log.
I have a user that I'm watching, expecting it to gain the role when it does synchronize .
Comment #7
rallycivic commentedIn the README, it says:
--
Each CiviCRM Contact on your site will need a corresponding Drupal User account
in order for CiviMember Roles Sync to synchronize Membership Types to Roles.
--
Will it only work if that is true?
I have many contacts in CiviCRM, some of which are in the group I which to sync to a role. Not all of those in that CiviCRM group have Drupal accounts.
Can this synchronize for only the CiviCRM group members that do have a linked user account, which skipping those that do not already have a Drupal account?
Comment #8
rallycivic commentedI tried a quite hack, changing line 422:
//Error check
if($uid === FALSE) {
//return FALSE;
continue;
}
The manual sync button now takes longer, and comes back with a positive message. My accounts have now gained the expected role!
This seems to allow skipping the cases where there is no corresponding Drupal user account.
This makes it work fine for me :)
Comment #9
Anonymous (not verified) commentedAh, I was going to suggest to comment out all the return FALSE statements to force it to sync. Good to know you were able to solve the problem by commenting out only one of those statements. Yes, it is required to have a Drupal account for each contact if you want to control access using Drupal accounts and roles (it is self-explanatory as to why that is, I think). However, I never intended to force people to have a Drupal account for every contact. I will remove those lines and publish a new release tonight.
Thank you very much for solving the issue!
Comment #10
Anonymous (not verified) commentedComment #11
aloknarwaria commentedI am also facing the same issue in my custom module.
I call the function before the class 'CRM_Core_DAO' use:
civicrm_initialize( true );
In your case i will suggest you please load the above function in your custom module under the HOOK_init() function.
This will help you.