CiviCRM 2.1+ compatibility
mboudey - April 21, 2008 - 22:49
| Project: | CiviCRM Subscribe |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Description
After installation, I get this when clicking on the Admin - Configuration - Subscribe link,
Fatal error: Call to undefined function crm_get_groups() in
/public_html/demo5/modules/civicrm_subscribe/civicrm_subscribe.module on line 43
Did I d something wrong?
I have Drupal 5.7 and Civic CRM 2.0 installed properly.
Thanks for the help.

#1
Version 1.2 doesn't support the version 2.0 of CiviCRM so you have to apply this patch:
http://drupal.org/node/235904#comment-779724
#2
OK, thanks tostinni.
#3
I got this exact error after fresh install of D6 dev build
#4
The patches in #235904: CiviCRM 2.0 compatibility work against the 5.x version of the module. They are not compatible with 6.x. If I have time, I may create a patch for 6.x, now that I see what needs to be done. It's just tedious more than anything else.
#5
Note that to make the patch compatible with CiviCRM 2.2, the function has been changed (yet again) to civicrm_group_get (cf. the Group API documentation).
#6
Actually, there are many changes between the APIs for CiviCRM 1.x and CiviCRM 2.1+. I haven't yet been able to get a working version of this module, but at least this one doesn't give function not found errors.
#7
Ok, here's a patch of CiviCRM Subscribe that worked for me. It uses the CiviCRM API as mentioned in #415232: Migrating to CiviCRM 2.2, although the civicrm_subscribe() function and related functions mostly work as well.
All you would need to do to test out the civicrm_subscribe() function (and the drupal_mail functionality) would be to switch which part of civicrm_subscribe_form_submit() is commented out. Note that the token substitution is not currently working in the drupal_mail functionality, which is why I switched to the CiviCRM API (not to mention that it's just simpler).
Note that you will have to make sure your groups are publicly visible in CiviCRM if you want the subscribe to work successfully.
Please test this patch so we can get it or something similar committed to the 6.x branch of CiviCRM Subscribe. The 6.x branch is completely broken as it is.
#8
Also, I just saw that menu strings shouldn't be wrapped in t(). So that would need fixing too, but it's trivial.
#9
I created a patch based on the original released dev version, that means includes your changes.
I also commented out in the form to get first and last names, and commented the other mail settings in the configuration. I Guess if you want to support drupal mail that has to come back, but in the mean time this works good.
#10
This works, after a couple tweaks.
1. civicrm_subscribe_block needed to initialize civicrm and require the v2/Group.php
2. civicrm_subscribe_admin_settings needed to require the v2/GroupContact.php
#11
After applying pelicani's tweaks, the patch in #9 works for me. I'll try to re-roll the patch soon, when I have time.
Also note, however, what I said in #415232-7: Migrating to CiviCRM 2.2: you have to set your groups' visibility to Public if you want them to be subscribable, as per CRM-1797.